script to delete and replace files

Ignacio Gómez igomezu at gmail.com
Wed Sep 7 00:33:29 UTC 2005


i´m writing a script to backup some files, the idea is to backup the file 
adding the date. I will copy the file tgz to another folder. This is a daily 
backup and it is so large. So I need the new one file tgz replace the oldest 
in the folder comparing the date how to do that?

i did something like that :

fecha=`date +"%y%m%d"`

1)
time tar -czvf /var/BACKUP/ftpuser.$fecha.tgz /home/ftpuser so the result is 
ftpuser060905.tgz (size 30gb) so next day I need the new file tgz 
ftpuser070905.tgz replaces the previous one i mean, delete the previous one 
and put the new one. How to do that?, sorry i'm not good at programing


thanks

Ignacio Gómez
Bogotá Colombia



More information about the redhat-list mailing list