 |
Linux Format forums Help, discussion, magazine feedback and more
|
| View previous topic :: View next topic |
| Author |
Message |
mmorenopc
Joined: Tue May 31, 2005 5:41 pm Posts: 1
|
Posted: Tue May 31, 2005 5:49 pm Post subject: shell script backup system |
|
|
Hi all!!, I have being trying an script I found in a magazine to put in place a simple way to incrementaly backup files in a directory, i have tryied all sort of combination but the error persist, is something with xargs but i can see it
the script is:
find /home/office/ -newer /home/backup/office-backup-`date -I -d yesterday`.tgz \! -type d | xargs tar -zcvf /home/malcolm/office-date -I.tgz
And for more than i check what coung be wrong I can't see it and i get this error message
Any idea what migh be wrong ?
xargs: unmatched single quote
Thanks a lot a the force be with you !! |
|
| Back to top |
|
 |
nelz Moderator

Joined: Mon Apr 04, 2005 12:52 pm Posts: 7995 Location: Warrington, UK
|
Posted: Tue May 31, 2005 7:56 pm Post subject: RE: shell script backup system |
|
|
Try this
| Code: |
find /home/office/ -newer /home/backup/office-backup-$(date -I -d yesterday).tgz \! -type d | xargs tar -zcvf /home/malcolm/office-$(date -I).tgz |
$() is more readable than backticks, once you switch to those, you see you left them out of the archive name.
This will work provided none of your filenames include spaces, or any other shell reserved characters. xargs falls over on those. A more robust solution would be
| Code: |
find /home/office/ -newer /home/backup/office-backup-$date -I -d yesterday).tgz \! -type d -exec tar -cf /home/malcolm/office-$(date -I).tar "{}" \;
gzip /home/malcolm/office-$(date -I).tar
|
_________________ Unix is user-friendly. It's just very selective about who it's friends are. |
|
| Back to top |
|
 |
| View previous topic :: View next topic |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|
|