Directory watching

Bart Silverstrim bsilver at chrononomicon.com
Tue Oct 16 13:40:28 UTC 2007


Is there a simple script or method under ubuntu to check every, say, 
five minutes a particular directory and copy the contents to a second 
directory and at the same time compare and notify me if the original 
directory has the contents change?

In other words,
/mnt/windows/foldertomonitor

Is mounted with five files.  The script or application runs, checks the 
contents, and copies them to

/home/me/temp/archive

Once there it checks every five minutes, if a file is added, the file is 
copied to /home/me/temp/archive and a log in /home/me/temp says, "File 
$NAME has been added at $DATE $TIME"

If a file is deleted from /mnt/windows/foldertomonitor, it is NOT 
deleted from /home/me/temp/archive, but the logfile tells me $NAME is 
altered at $DATE $TIME.

If a file is modified, it is copied to /home/me/temp/archive/$NAME_1 and 
a note in the log says "File $NAME has been modified at $DATE $TIME".

That's the idea of the kind of thing I was looking for.  Any ideas, 
pointers, tips...?  I'm less than shoetread in the programming 
department. :-/




More information about the ubuntu-users mailing list