jb2170/better-adb-sync

Can't get --exclude to work with --pull

Opened this issue · 1 comments

I'm trying to copy the entire contents of /sdcard from a device to a computer while excluding certain large directories (such as the Spotify cache). But I can't seem to get the --exclude flag to work correctly.

I've tried:

adbsync.py -L --exclude "/sdcard/Android/data/com.spotify.music/" --pull . /sdcard/
adbsync.py -L --exclude "/sdcard/Android/data/com.spotify.music/*" --pull . /sdcard/

But both commands result in the excluded directories being copied:

/sdcard/Android/data/com.spotify.music/files/spotifycache/Storage/6f...88e574ac209a58b.file: 1 file pulled. 2.1 MB/s (3601 bytes in 0.002s)
/sdcard/Android/data/com.spotify.music/files/spotifycache/Storage/6f...a205583bf104.file: 1 file pulled. 19.4 MB/s (101635 bytes in 0.005s)
/sdcard/Android/data/com.spotify.music/files/spotifycache/Storage/6f...f36ae173de05.file: 1 file pulled. 25.4 MB/s (164866 bytes in 0.006s)

Am I using the flag incorrectly? It would be great to have some example usage for each of the flags in the README and when you run the script with no arguments.

Quoting README.md:

Each should be a fnmatch pattern relative to the source.

So you should remove /sdcard/ from your exclude pattern.

See Python documetation for fnmatch. You may use * to match parts of a complete (relative) path, even including / characters.