I'm building a backup script where some directories should not be included in the backup archive.
cd /; find . -maxdepth 2 \ \( -path './sys' -o -path './dev' -o -path './proc' -o -path './media' -o -path './mnt' \) -prune \ -o -print
This finds only the files and directories I want.
Problem is that
cpio should be fed with the following option in order to avoid problems with permissions when restoring files.
find ... -depth ....
And if I add the
-depth option, returned files and directories include those I want to avoid.
I really don't understand these sentences from the find manual:
-prune True; if the file is a directory, do not descend into it. If -depth is given, false; no effect. Because -delete implies -depth, you cannot usefully use -prune and -delete together.