Given a base directory (like /home/user
) is there a command that could be run which would create an archive back up all text files (i.e. files less than 100kb) in that directory and it's children? I know you can tar/gz a directory - but what about excluding files also?
The idea is that most photos, videos, and other large files would be ignored while all important hand-typed documents could easily be backed up quickly when moving around projects and servers.
UPDATE
Using skinp's awesome code I was able to backup a small amount of the files. However, as DerfK pointed out - there is a limit to the size of arguments you can pass to commands. With that in mind I was able to write out the contents of find
hoping that I could use something to read the contents to tar
and bypass this limit. The other other option seems to be a sh script that could ad each file to the archive at a time.
find /home/username -type f -size -100k > list.of.small.files.txt
Which rendered out a 6MB file.