Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to exclude a certain folder? #25

Closed
hammi1 opened this issue Apr 1, 2018 · 4 comments
Closed

How to exclude a certain folder? #25

hammi1 opened this issue Apr 1, 2018 · 4 comments

Comments

@hammi1
Copy link

hammi1 commented Apr 1, 2018

Is there a way to exclude certain folders from being transferred, in either a forward or reverse sync?

For e.g., my main conundrum is that I want to sync my phones /sdcard/ folder onto my backup drive, which would add all new pictures/videos and downloads. However, I want to exclude the /sdcard/Android/ folder which has unnecessary cache files.

Is there a way to do this, or would it be better for me to sync only the most needed folders (such as DCIM, Downloads, etc)?

Thank you

@d3adb5
Copy link

d3adb5 commented Apr 14, 2018

Since the feature request still hasn't been taken and whatnot, you can do something like a shell loop through extended globbing.

for directory in !(UnwantedPattern); do
    adb-sync "$directory" /storage/5111-3BEE
done

This can help for forward syncs, but I don't think there's a very easy workaround for directories on your Android phone itself.

@hammi1
Copy link
Author

hammi1 commented Apr 14, 2018

Thank you for that, though for the case on my system is the reverse sync to backup my Android to my HDD.

I have resorted to backing up few important folders that I need instead, using an array and a for loop to sync said folders, as shown below.

This way might actually be better, because I wouldn't need the random folders in /sdcard/ created by apps, nor the Android folder inside /sdcard/, given that it contains caches and isn't as necessary as my pictures/music/etc. I can also add into the array any other folder I want transferred

declare -a arr=("DCIM" "Downloads" "audio" "Pictures" "APK" "ZIP")

for FolderStr in "${arr[@]}"
do
        ./adb-sync/adb-sync --reverse /storage/emulated/0/$FolderStr/ /media/DATA/OP3T/sdcard/$FolderStr/
# echo "$FolderStr"
done

@divVerent
Copy link
Contributor

Duplicate of #21.

@DoctorSubtilis
Copy link

Hi, @https://github.com/skewerr I tried your code

for directory in "!(-*)"; do
  adb-sync /home/schede/cultura/inglese/. sdcard/Documents/inglese/
done  

But I'm not able to sinc my folder with the tablet. I have to sync all except symlinks (folders and files). Can you help me?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants