LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 02-08-2004, 12:33 PM   #1
wishbone42
LQ Newbie
 
Registered: Aug 2003
Location: Berkshire
Distribution: SuSE 7.3 and 8.2
Posts: 6

Rep: Reputation: 0
tar backup & restore of current directory


Hi,

I've been able to backup and restore a directory and its subdirectories using tar cvf foo.tar foo/ and tar xvf foo.tar.

This works well when I have a whole directory and subdirectory structure to archive and restore.

However, I need to create an archive of a web directory on my server, upload it to an ISP's web server and then extract the archive in the web root directory.

This means that I don't need the archived top level directory, but I haven't yet discovered a way to archive the current directory files and the subdirectories.

I've tried

tar cvf - find . -print > backup.tar (O'Reilly)

but I get the following error

"You may not specify more than one `-Acdtrux' option"

Has anyone any ideas as to how I may do this?

Thanks.
 
Old 02-08-2004, 01:12 PM   #2
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 56
I run this from the directory which I want to backup. It does the sub directories also......
Note: the place where the file gets stored is /home/backup/ in my case and the directory to get backed up is represented by the period ( . ) at the end.
Using the current date for the file name.

filename=`date '+%m%d%y'`
tar -cvzf /home/backup/${filename}.tar.gz .
 
Old 02-09-2004, 01:30 AM   #3
Berhanie
Senior Member
 
Registered: Dec 2003
Location: phnom penh
Distribution: Fedora
Posts: 1,625

Rep: Reputation: 165Reputation: 165
To archive the current directory and all subdirs, you could just do a
tar -cvf backup.tar *
(you would add a "z" to gzip it)
 
Old 02-09-2004, 02:30 AM   #4
wishbone42
LQ Newbie
 
Registered: Aug 2003
Location: Berkshire
Distribution: SuSE 7.3 and 8.2
Posts: 6

Original Poster
Rep: Reputation: 0
Homey/Berhanie,

Thanks for the guidance. I've tried both suggestions and they have done what I needed.

Best regards,
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Backup and Restore with TAR jay2809 Linux - Newbie 7 08-25-2004 04:47 PM
tar to restore backup -- goes to sleep?!? JZL240I-U Linux - Software 4 05-10-2004 02:55 AM
Backup & Restore plan using tar markcasazza Linux - Newbie 1 04-14-2004 01:11 PM
backup and restore using tar AZDAVE Linux - General 6 11-28-2003 08:40 PM
how can I restore a tar backup len snelly Linux - Newbie 1 04-30-2002 12:29 PM


All times are GMT -5. The time now is 10:05 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration