Mailing List Archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [tlug] Using tar to archive files



Hi Dave.

> tar -cvzf archive.tgz -C directory * --exclude directory/subdir

I would have thought the * would get expanded by the shell before it even reached the tar command. That means it's going to feed tar everything in your working directory, not everything in the directory you're telling tar to change to.

Maybe something like this would work?
tar -cvzf archive.tgz -C directory . --exclude directory/subdir

Not sure I understood the bit about empty directories, so I can't help you with that, I'm afraid... (If they're under directory/, the above should catch them whether they're empty or not. Are you trying to get the sub-directories under directory/, but ignore their contents?)

Edmund


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links