Directory watching

Andrew Glen-Young aglenyoung at gmail.com
Tue Oct 16 14:13:02 UTC 2007


On 16/10/2007, Bart Silverstrim <bsilver at chrononomicon.com> wrote:
> 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. :-/
>

I don't know of any utility specifically created for this, but
'rdiff-backup' should suffice for your situation.

It is a backup tool, which you could run at 5 minute intervals to
achieve your goal.
Other backup tools could also be used.

If you're not comfortable with scripting then perhaps you could find a
suitable GUI for 'rsync'?

- A.




More information about the ubuntu-users mailing list