LinuxQuestions.org
Visit Jeremy's Blog.
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-10-2009, 05:57 AM   #1
Matey
Member
 
Registered: Jan 2009
Posts: 108

Rep: Reputation: 17
Question Backups Using Tar (Question)


Hi;
I found this script (thanks to some cool guy at IBM) which will backup the entire file system into one .tgz file and puts the current time/date as name on it, except I get errors when it tries to tar folders like /sys or /dev etc, (I think). it ends saying:
tar: Error exit delayed from previous errors!?
(whatever that means?)
So I put the --exclude in the line;

Code:
#!/bin/sh
tar czvf --exclude='*.tgz' --exclude='/sys' --exclude='/dev' --exclude='lost+found'  $1.$(date +%Y%m%d-%H%M%S).tgz $1
exit $?
As you can see there are too many --exclude= in there and it makes it messy.

Is there any way I could use only one --exclude switch and then put all the files/folders I want to exclude in that one instant?


sorry if it's too easy for some of you , this is new to me.
Thanks!

Last edited by Matey; 02-10-2009 at 05:59 AM.
 
Old 02-10-2009, 06:02 AM   #2
skuzye
Member
 
Registered: Jul 2008
Location: São Paulo - Brazil
Distribution: Fedora 17
Posts: 97

Rep: Reputation: 15
Have you tried using only one exclude and listing all the folders separated by space?

Skuzye
 
Old 02-10-2009, 06:36 AM   #3
theYinYeti
Senior Member
 
Registered: Jul 2004
Location: France
Distribution: Arch Linux
Posts: 1,897

Rep: Reputation: 61
It seems to depend on what you call messy. In my opinion, your solution is more messy than several --exclude…

Yves.
 
Old 02-10-2009, 06:38 AM   #4
theYinYeti
Senior Member
 
Registered: Jul 2004
Location: France
Distribution: Arch Linux
Posts: 1,897

Rep: Reputation: 61
You should have a look at --exclude-from=FILE

Last edited by theYinYeti; 02-10-2009 at 06:41 AM.
 
  


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
tar archival backups arbis Linux - Software 2 10-20-2008 09:24 PM
backups using tar and rsync cucolin@ Linux - Server 2 04-03-2007 12:25 AM
Tar for backups ? Proper syntax ? Reefcrazed Linux - Newbie 8 02-21-2006 05:18 PM
tar or cpio - Which is better for tape backups? Br. Nicholas Linux - Software 2 07-02-2003 04:06 PM
Incremental tar backups Pepe Linux - General 5 03-18-2002 03:31 AM


All times are GMT -5. The time now is 11:02 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