Mailing List Archive


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

Re: [tlug] Using tar to archive files



Dave M G wrote:
Edmund,

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

That puts all the files inside the archive underneath a directory named ".".



Not sure I understood the bit about empty directories, so I can't help you with that, I'm afraid...

It looks to me like the default behavior is for empty directories to not be included in the archive. When I create an archive then view it with the Archive Manager application, they don't seem to be there.



Hmm, I don't seem to have trouble with empty directories at all (Debian Etch). With the following directory structure:


sigurdur@??:/tmp$ tree test/
test/
`-- web
   |-- empty
   |-- empty2
   |-- exclude
   |   |-- 1
   |   |-- 2
   |   `-- 3
   |-- non-empty
   |   |-- 1
   |   |-- 2
   |   `-- 3
   `-- non-empty2
       |-- 1
       |-- 2
       `-- 3

(this is comparable to what you have I assume)

and this command:

tar -vv --create -f tar-test.tar --exclude /tmp/test/web/exclude/ -C /tmp/test/web/

I get the following archive:
sigurdur@??:/tmp$ tar -tf tar-test.tar
./
./empty/
./empty2/
./non-empty/
./non-empty/1
./non-empty/2
./non-empty/3
./non-empty2/
./non-empty2/1
./non-empty2/2
./non-empty2/3
./exclude/
./exclude/1
./exclude/2
./exclude/3

kind regards,

-sig



--
Sigurd Urdahl
Linux, goofing, cooking, making fire, computer security, having a
beer. Give me good music.



Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links