Results 1 to 5 of 5

Thread: How to trigger a script by changes in folders

  1. #1
    Join Date
    Jul 2008
    Location
    SC, CA, USA
    Beans
    17
    Distro
    Ubuntu 10.10 Maverick Meerkat

    How to trigger a script by changes in folders

    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.

    Thanks.

  2. #2
    Join Date
    Jun 2009
    Location
    Alabama
    Beans
    2,232

    Lightbulb Re: How to trigger a script by changes in folders

    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.

    Tim

  3. #3
    Join Date
    Oct 2008
    Beans
    561

    Re: How to trigger a script by changes in folders

    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.
    Check out my little app. Tnote

  4. #4
    Join Date
    Oct 2007
    Beans
    1,815

    Re: How to trigger a script by changes in folders

    I like the unison application for this. Why reinvent the wheel?

    Code:
    unison - A file-synchronization tool for Unix and Windows

  5. #5
    Join Date
    Oct 2008
    Beans
    561

    Re: How to trigger a script by changes in folders

    Quote Originally Posted by llamabr View Post
    Why reinvent the wheel?
    well he already has but to answer your question
    Attached Images Attached Images
    Check out my little app. Tnote

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •