tar all but these...
I want to tar a directory, except for 2 subdirectories within that directory.
What are the options for tar that will let me do that? |
i wonder, do you know man? In case you don't: type
man man to get an explanation. In case you know man, do you know that you can search in man pages by typing / and the word you search for? try for example: man tar and in the program type /exclude and tada you have what you where looking for. offence meant! short: tar cf <whatever.tar> --exclude=<file you do not want to include> |
Quote:
|
Quote:
|
Anyway, I don't make a habit of asking a question here unless I have first looked in man and found the information sparse or unhelpful. To wit: the description of --exclude simply states that FILE will be excluded. It doesn't give any additional information, such as how I can specify multiple files in the --exclude argument or if I can specify directories. I assumed that I could specify directories and that I would write a tar command, excluding 3 directories (My Documents, Program Files, and the windows directory) from my Windows partition along these lines:
tar -czvf todaysarchive.tar.gz /mnt/win_c --exclude My\ Documents Program\ Files windows But, that didn't work: one of the first things tar did was to write mnt/win_c/windows/* to the archive. (At which point, I killed the job.) If anyone can help, consider me thankful! |
Well sorry for my rudeness.
you need the = after --exclude, and you have to give --exclude for every exclusion iirc. try: tar -czvf todaysarchive.tar.gz /mnt/win_c --exclude=My\ Documents --exclude=Program\ Files --exclude=windows if that doesn't work try to quote the exclusion directories,e.g.: tar -czvf todaysarchive.tar.gz /mnt/win_c --exclude="My Documents" --exclude="Program Files" --exclude="windows" |
Merci, gracias, thanks, or what you will.
|
hehe stupid me:)
I forgot that you have to give the path. The above might work, but if it does not try the following: tar -czvf todaysarchive.tar.gz /mnt/win_c --exclude="/mnt/win_c/My Documents" --exclude="mnt/win_c/Program Files" --exclude="mnt/win_c/windows" seems that not only my temper but also my memory has suffered a bit today, well well well. |
If nobody else ever ranted first and thought later, then I'd be forever "persona non-grata" in forums. I'm just glad the thread turned productive.
And the first method worked, though I will note the necessity of including the full path for future reference. |
unfortunately,
all these didn't work with me ... i'm really looking for something similar i have a huge folder with one huge subfolder that i wish to exclude from taring it ... any tested commands? |
Error messages if any? What command did you use, and was the file created?
|
no error msgs, every command i used ( well all are listed above) they just tar everything .. i had to kill the process everytime
i want to exclude a folder .. not a file thanks |
Yeah well thats not much input.
Do you have a link to the directory you exclude somewhere in the included directoris? That would be the only thing I can think of right now. |
ok i will give u exactly what i do:
i have a site on a server .. and now am in the root folder of that site.. fine? there are many subfolders in the root folder ... one of them is the httpdocs folder that contains the site's files i have temp folder that i do some testing in it ..and it contains huge files that i don't want to include when i do a full back up for the httpdocs folder .. the command i used was: tar -cvf backup.tar httpdocs/ --exclude httpdocs/temp/ this would tar everything .. it tars what the temp folder contains i tried the commands listed in this thried but they all tared everthing:) any other things you want to know? thanks |
The --exclude requires and = after it. It reports no error if it is missing, it just doesn't work. Kinda stupid but we got to live with it.
try: tar -cvf backup.tar httpdocs/ --exclude=httpdocs/temp/ |
All times are GMT -5. The time now is 07:42 AM. |