If you find yourself stuck with over 30,000 files in a directory (text files in this example), packing them into a tar file can be tricky. You can get around it with this:
find . -name '*.txt' -print >/tmp/test.manifest
tar -cvzf textfiles.tar.gz --files-from /tmp/test.manifest
find . -name '*.txt' | xargs rm -v

What if I have a few directories and this adds up ?
Should i tar all 10 directories as 10 tar files, then tar them together, or should I run find 10 times and combine the results into 1 txt tmp file. ?
I should try them first... thanks
Dennis Quek > I've that "find" will make the list of all the directories, recursively ! So the very useful commands shown here should work out-of-the-box...
Thanks !
3 years after this post was made, it still is VERY useful.
It was for me at least, and I guess it has been for others, since it was #1 in Google for my query.
Maybe littl late, but another simple way to tar the full directory content with lot of files is doing this:
Assuming you are in the directory of interest.
"Bad" way:
$ tar cfz bk_name.tar.gz *
Alternative:
$ tar cfz bk_name.tar.gz ./
regards
Thanks for sharing this. It is very useful.
THX --> what a beautiful work arround...
regards
chewie