I needed to backup staff members’ homepages located at homedirs and access by Apache’s http://site/~name
so tar.gz the whole /home, but:
- users got some private stuff in the $HOMEs
- their $HOME/public_html is what I need to backup, but they got some large files in there
so…
find home -perm /004 -size -5M -type f -print0 | xargs -0 tar -rvf home.tar
-perm is for ‘readable to all’ files; size <5MB; type – only files (since tar is appending (r) and not creating (c) new archive with each file! )
the last hour was about dealing with files containing whitespaces, since xargs got each argument seperated by any whitespace… so -0 is for arguments seperated by null and -print0 is for listing files terminated by a null character instead of by whitespace