-   Linux - Software (
-   -   backup script question (

lordofring 04-15-2005 01:08 PM

backup script question

I have an incremental backup script for my linux box. I used "find -mtime 1" to find all of files accessed on today. But the result is huge. If a file name is changed, the directory is returned. So the whole directory is backed up. At the end, the size is too big for me to backup everyday.

So I modified a little to "find -mtime 1 -type f". The return is much smaller since it only return the files changed on today. But it bring me another problem. If I changed a directory's name like "mv dir1 dir2", nothing will be backup because no file is changed. It will cause my problem when I resotre it in the emergency case.

Anyone could give me some hint to accomplish these two goals together?


tangle 04-15-2005 01:23 PM

When I get home I'll post the find command and how to get tar to backup the files. I do not have the info onhand right now, sorry.

abhijeetudas 04-15-2005 01:37 PM


Im need to do incremental backups too..
could u paste the script u use so i can use
the script too..

Madd_hatter 04-15-2005 02:26 PM

Not to say there's not a way to fix your script, I have no idea. But have you looked into partimage? It's a linux backup utility that does incremental backups. I haven't personally used it but I was looking into it and I think it might suit your needs nicely.

tangle 04-15-2005 10:29 PM

Sorry for the late post.

The find command you need is:
find / -mtime -1 \! -type d -print > /tmp/filelist.daily

This will find all files accessed in the last 24 hours and print the list to the file /tmp/filelist.daily.

To get tar to read the list and archive the files:
tar -cv -T /tmp/filelist.daily -f /mnt/share

This will create the tarball in the /mnt/share directory.

lordofring 04-16-2005 07:59 AM

Thanks tangle. I will try it on Monday.

lordofring 04-18-2005 11:19 AM


After I run "find / -mtime -1 /! -type d ", I will get the all files that changed in 24 hours. It does not solve my problem. My problem is that if a directory only changed name by "mv", the super-directory's last modified time is changed and so the whoe super-directory is backed up. I do not want to waste space. (I only want to backup the directory with the new name.)

Thank you the reply.

tangle 04-18-2005 11:25 AM

Sorry, I mis read the post. I believe that you can use the touch command to change the access time for files and directories.

Then all you have to do is touch the directory and/or files after you move them.

All times are GMT -5. The time now is 01:30 PM.