I would like to recursively troll through my OS X and or nix systems, find files of importance based on file extension, and put them in a compressed tar. The problem I am having is getting Tar to accept the standard input from the prior commands. Here is what I have so far using .doc just as an example: find / -type f -print | grep -iE '\.doc$' | tar -czvf test.tar.gz
Something like that is my goal...
Currently I am writing all results fromthe find/grep to a text file, then using the Include-files switch with Tar to tar them up via and && which just isn't as pleasing. Any ideas?
HippieJoe
PS. I tried using cpio with format tar then pushing it to gzip...i kept getting archive truncated errors.
Old post, but .... do you have to have a one-liner?
Can not help you, however ...... e.g.
find . -name '*.java' >flist.txt
tar czvf a.tar.gz --files-from flist.txtGuy
OK, the one-liner (on Linux, YMMV with OSX): find . -name '*.java' | tar czvf a.tar.gz --files-from -
Guy, Thanks a ton!! I never could get that standard out switch in the right place...I was using a two liner like your first suggestion. I like this much better!
The solution to find all files, tar and gzip them when the file ENDS in a .txt
(thanks to Guy):find . -mount -depth -type f -print | grep -iE '*\.txt$' | tar -czvf ../test.tar.gz -T -
Thank you!
HippieJoe
| « Open Source Email Server ... | Installing a RUN file.... » |