Sign up ×
Android Enthusiasts Stack Exchange is a question and answer site for enthusiasts and power users of the Android operating system. It's 100% free, no registration required.

With the command "adb pull /sdcard/" I can copy all the contents of the internal memory of my Android phone into my current local directory (and "adb pull /mnt/extSdCard/" does the same with the external SD card). But that command always copies everything, even files I already have stored locally.

Is there any way to copy only new and modified files? (files with a newer date)

share|improve this question

2 Answers 2

up vote 1 down vote accepted

As described by ss-3-1415926535897932384626433 there is no flag, but you have to get a list of files first and then check if your local files match. I wrote a little script for it:



adb shell ls "$rfolder" > android.files

ls "$lfolder" -1 > local.files

rm -f update.files
touch update.files

while IFS=  read -r q; do
  # Remove non-printable characters (are not visible on console)
  l=$(echo ${q} | sed 's/[^[:print:]]//')
  # Populate files to update
  if ! grep -q "$l" local.files; then         
    echo "$l" >> update.files
done < android.files

cd $lfolder

while IFS=  read -r q; do
  # Remove non-printable characters (are not visible on console)
  l=$(echo ${q} | sed 's/[^[:print:]]//')
  echo "Get file: $l"
  adb pull "$rfolder/$l"
done < ../update.files

Adjust the remote folder rfolder and the local folder lfolder to locations of your own choice.

share|improve this answer
This looks pretty good. Does it also work recursively or just in a single directory and no subdirectories? –  OMA Sep 16 at 22:56
This is non-recursive indeed, but feel free to improve. :-) –  Anne van Rossum Sep 19 at 19:08
Also note that I don't compare dates here yet, so if you have altered files they won't get updated. –  Anne van Rossum Sep 19 at 19:10

adb pull doesn't seem to provide a flag to pull selected files.

As a workaround, you can do this: Use adb shell [Unix shell command] to copy selected files to a temporary location and then pull all files from that location.

You can use cp -u [source] [destination] unix shell command to copy only modified files on subsequent run. You can also use -r flag to use it on subdirectories recursive, if its required.

share|improve this answer
Thanks for your answer. Copying all files to another location to then maybe update just one changed file is pretty slow. Too bad that adb doesn't provice in way to copy only newer files. –  OMA Feb 28 '13 at 4:50
@OMA You can use the shell to get a list of new files, and then use adb pull on that list. –  Matthew Read Feb 28 '13 at 16:35
@MatthewRead Any hints on how to do that? Thanks! –  OMA Feb 28 '13 at 17:29
@OMA I am unable to understand your problem with this. Use both commands in one line or create alias (also add a command to purge temp location after operation). If there was a flag of adb pull for that, it'd work the same way. –  SS-3.1415926535897932384626433 Mar 2 '13 at 10:42

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.