Giter Site home page Giter Site logo

nathanlogan / directory-changed-listener Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 1.0 100 KB

This is a bash script that listens for a change in a given directory (and its subdirectories). When one is noticed, it runs another bash script (in which you do whatever you want to do).

Shell 100.00%

directory-changed-listener's Introduction

directory-changed-listener

This is a bash script that listens for a change in a given directory or any of its subdirectories. When one is noticed, it runs another bash script (in which you do whatever you want to do).

Compatability

It has only been tested on Mac OS X 10.7, but should work on most Linux-based systems.

How to use it

To start it

To run it on Mac OS X, you'll first need to open up Terminal.

If you have the listener script at "~/Sites/directory-changed-listener/dirListener.sh", you would type the following:

cd ~/Sites/directory-changed-listener

sh dirListener.sh /dir/to/listen/to

Alternatively, if you want to move the script to the root of the directory you want to listen to, once you have moved it there, you would type the following:

cd /dir/to/listen/to

sh dirListener.sh

That is, if you don't feed the script its first parameter (a directory to listen to), it assumes you want to listen to the one in which it resides.

To stop it

Simply type:

CTRL + c

To make it do your bidding

You'll need to edit the dirChanged.sh file to perform whatever action you want at the time a directory change is noticed. For example, maybe you want to send an email because an intruder has hacked into your files! Whatever it is, this is the file where you work your magic.

Important note:

You must keep the dirChanged.sh file in the same directory as the dirListener.sh file. The listener fires off dirChanged.sh when a directory change is noticed.

directory-changed-listener's People

Contributors

nathanlogan avatar

Stargazers

Matteo Toto avatar  avatar

Watchers

 avatar

Forkers

cloudxtreme

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.