Example File of Fsniper Config File

watch {
     
    # watch the ~/drop directory for new files
    ~/one {
        # matches any mimetype beginning with image/
        image/* {
            # %% is replaced with the filename of the new file
            handler = echo found an image: %%
        }

        # matches any file ending with .extensio
      
        *.txt {
            # the filename is added to the end of the handler line if %% is not present
            handler = /bin/sh %% ; cp ~/one/*.txt ~/two
            # the second handler will be run if the first exits with a return code of 1
            handler = echo glob handler 2: %%
        }

        # run handlers on files that match this regex
        /.*regex.*/ {
            handler = echo regex handler
        }

        # generic handler to catch files that nothing else did
        * {
            handler = mv %% ~/downloads/
        }
    }

}





##############################################################################

What does it do?

The text in blue actually does the trick.

As soon as you make a *.txt in ~/one folder, fsniper immediately copies the file to ~/two
If you make a file that does not have .txt extension, fsniper does nothing.

For installation/configuration of fsniper see:

http://pc2solution.blogspot.in/2012/11/installing-configuring-fsniper-advanced.html
http://pc2solution.blogspot.in/2012/11/fsniper-file-to-be-put-in-etcinitd.html



Comments