View Full Version : [all variants] How to trigger a script by changes in folders
August 2nd, 2009, 10:20 PM
I just wrote a simple script to mirror my music onto another partition of my machine, and I was wondering if there is some way of monitoring those folders for changes, and triggering the script to run again. Excuse me if this has come up - this is one of the few times I couldn't find an answer searching.
August 2nd, 2009, 10:48 PM
I would use the find command, possibly using the -newer option to see if some file was added or updated at a later time than some known file. Then, still on the find command, use the -exec option to start your script.
August 2nd, 2009, 11:01 PM
to have it run automatically you will either need to write a daemon or have cron (or anacron) run a check automatically.
another option would be to run the script on shut down.
August 2nd, 2009, 11:10 PM
I like the unison application for this. Why reinvent the wheel?
unison - A file-synchronization tool for Unix and Windows
August 3rd, 2009, 12:01 AM
Why reinvent the wheel?
well he already has but to answer your question
Powered by vBulletin® Version 4.2.2 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.