|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
You eat, breathe and sleep innovation. Build your mobile intelligence with BlackBerry® experts this July. Register Today! |
|
#1
|
|||
|
|||
|
I'm not sure what my title should be exactly.
I'm trying to tar up entire directory but specify which files to take because some files need to be ignored. The files that need to be ignore are "hidden" files that start with ".". The directory , say named MainPages contain files as well as directories. Then under the next level directory, say named images contain files and more directories. MainPages/ .randomhiddenfile index.txt startup.java images/ .imagehiddenfile logo.jpg people/ animals/ And so on.... I can't remove the hidden files as they are used for other purposes elsewhere. I do tar cvf test.tar MainPages/[a-zA-z]* and that will work to not include .randomhiddenfile but will still include the files under images. I can't hard code this because the names of the directories can change so I need to make it recursive, like for each directory under main do this sort of thing... |
|
#2
|
|||
|
|||
|
how 'bout:
tar cvf myTar.tar $(find MainPages ! -name '.*') or find MainPages ! -name '.*' -type f | xargs tar cvf myTar.tar |
|
#3
|
|||
|
|||
|
Quote:
The second one worked, but the first one didn't. Also, I was looking into tar and there is a X option to exclude files but I can't get it to work no matter what. Does someone have a working example? I need to list multiple files to exclude. No matter what I do it always includes them. |
|
#4
|
||||
|
||||
|
Quote:
if you ARE not using ksh/bash, try: tar cvf myTar.tar `find MainPages ! -name '.*'` Quote:
tar -cXvf tarr.X tarr.tar tarr tarr.X - file containg paths to files to be EXCLUDED tarr.tar - the tar file to be created tar - directory to be tar-ed |
![]() |
| Viewing: Dev Shed Forums > Operating Systems > UNIX Help > Tar / scripting quesiton - tar-ing recursively? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|