non-recursive Tar - Printable Version +- Linux-Noob Forums (https://www.linux-noob.com/forums) +-- Forum: Linux Noob (https://www.linux-noob.com/forums/forum-3.html) +--- Forum: Tips and Tricks (https://www.linux-noob.com/forums/forum-59.html) +---- Forum: Compressed Files (https://www.linux-noob.com/forums/forum-30.html) +---- Thread: non-recursive Tar (/thread-2547.html) |
non-recursive Tar - section31 - 2005-07-18 Is there a simple way to do a non-recursive tar. I've come up with a few sites that say there is a flag -n for it, but the distro (fedora 3) i'm using doesn't have that option. Any other alternatives? non-recursive Tar - KobrAs - 2005-07-18 Quote:Is there a simple way to do a non-recursive tar. please explain more cause i didnt understand non-recursive Tar - section31 - 2005-07-18 hm, not sure If I can make it any clearer but I'll try. Lets say I'm making a gzip tarball. Code: tar -cvzf archive.tar.gz foobarDirectory/ This will tar everything in foobarDirectory including all of the subdirectories in it, hence being recursive. I would like to know how would I go about taring a directory that doesn't tar its subdirectorys, but just the contents within that directory. A simple flag doesn't seem like an option as I looked in the man page and didn't see one. So, I will need to find an alternative, and if anyone could help that would be cool. It would probably involve a find piped with tar or something, but then again find is recursive also so I don't know. non-recursive Tar - section31 - 2005-07-18 Ok, after toying around I came up with this. I don't know if its the most efficient way though. Code: find foobarDir/ -name *.jpg -maxdepth 1 | xargs tar -cvzf backup.tar.gz non-recursive Tar - z0ny - 2005-07-19 Code: find foobarDir/ -name *.jpg -maxdepth 1 | xargs tar -cvzf backup.tar.gz equals Code: tar -cvzf backup.tar.gz foobarDir/*.jpg GNU tar also offers the "--no-recursion" parameter (kinda bad documented) where it skips directory contents. |