views:

21

answers:

2

I would like to run a backup job on a directory tree from a bash script if any of the files have been modified in the last 30 minutes. I think I can hack together something using find with the -ctime flag, but I'm sure there is a standard way to examine a directory for changes.

I know that I can inspect the ctime of the top level directory to see if files were added, but I need to be able to see changes also.

FWIW, I am using duplicity to backup directories to S3.

+2  A: 

For time in minutes, you should use -cmin -n

find /some/start/dir -cmin -30 -type f
Dennis Williamson
+1  A: 

Changes to files already in the directory do not cause a change in the directory's timestamps, so you need to check the files inside (e.g. with find as you suggest).

Arkku