> 
> I'm a little confused about the arguments for tar.
> I want to tar the contents of a directory and save that .tgz file for
> backup purposes.
> 
> Problem is, when I copy larry.tgz to /disk2 and:
> Tar xvfz larry.tgz
> It creates the /disk2 file structure within /disk2.
> 
> # cd
> # ls /disk2
> # freebsd larry (directories)
> # tar cvfz larry.tgz /disk2
> # cp larry.tgz /disk2
> # cd /disk2
> # tar xvfz larry.tgz
> # ls 
> # freebsd larry disk2 (directories)
> 
> How can I make tar not create the directory structure within the same
> directory?
> Does that make sense?
> I tried tar cvfzP, no joy.

Just cd in to the lowest level of directory structure you want
to preserve and do the tar from there.

So your example above would morph to:

 # cd
 # ls /disk2
 # freebsd larry (directories)
 # cd /disk2
 # tar cvfz ../larry.tgz *
 # 
 # cp ../larry.tgz /disk3  (NOTE: using disk3 for clarity - to avoid the
 # cd /disk3                      issue of replacing copies of the same file)
 # tar xvfz /larry.tgz
 # ls
 # freebsd larry (directories) larry.tgz

There are possibly other ways using switches, but this makes most sense.

////jerry

> 
> Man tar didn't have anything that jumped out at me, but I could have
> missed or misunderstood something.
> If the solution is in the man page, I would appreciate a reference to
> the section, so I can re-read it to understand.
> 
> 
> 
> Thanks,
> Charles
> 
> 
> _______________________________________________
> [EMAIL PROTECTED] mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "[EMAIL PROTECTED]"
> 

_______________________________________________
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to