Created
January 25, 2021 11:40
-
-
Save rw3iss/1db5d19a85470f2646ee2a1da1cf9fc5 to your computer and use it in GitHub Desktop.
Add .deja-dup-ignore file to all subdirectories matching a pattern
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This will only add it to the first instance/depth of the matching ignoreFolder (ie. it won't add it to the sub-dependencies of any node_modules folder | |
startPath=/home/rw3iss/Sites | |
ignoreFolder=node_modules | |
find $startPath -mindepth 1 -maxdepth 5 -name "$ignoreFolder" -type d -not -regex ".*$ignoreFolder.*$ignoreFolder.*" | while read fname; do | |
echo "" > "$fname/.deja-dup-ignore" | |
echo "$fname/.deja-dup-ignore created." | |
done |
Ah cool! I am not a bash expert and only dabble. I also don't use this script anymore - moved from DejaDup to Duplicity so I could manage things more manually. However, you just taught me how to parse options. Thank you! May the benevolent bash gods shine their favor upon you :-)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
With this at the beginning of the script, you don't need hardcoded paths ;-)
You can then use script like this:
$
addDejaDupIgnoreFiles.sh -s /home/rw3iss/Sites -i node_modules