Mailing List Archive


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

[tlug] Using tar to archive files



TLUG,

I'm trying to set up a tar command to create a backup archive, and I intend to include this tar command inside a shell script.

What I want to do is 3 things.

1. All my files that I want to store are in a directory called "web". I'd like to archive all the files inside that directory, but without also storing the "web" directory itself. I'd like to do this without storing my shell script inside the web directory.

2. Store some empty sub directories.

3. Exclude one sub directory.

I've succeeded with #3, but the first two still elude me.

Looking on the net, this is what I've come up with, though it isn't working as hoped:

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

First, it seems the "-d" command is supposed to store empty directories. But when I include the "-d" flag, it says "You may not specify more than one `-Acdtrux' option".

I specified the -C command, so that tar would start in that directory and begin storing files and folders from there. But it seems to just get lost and try storing everything in the same directory as the shell script.

Can someone help me tweak this command properly?

Thank you for your time and assistance.

--
Dave M G
Ubuntu 6.10 Edgy Eft
Kernel 2.6.17.7
Pentium D Dual Core Processor
PHP 5, MySQL 5, Apache 2


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links