In Linux system almost everything is a file. fsniper is a tool that monitors a given set of directories for new or modified files then applies rule based scripts. It is a very useful tool for handling files automatically when they are created. I have used if for many applications.

According to fsniper documentation fsniper was inspired by the need to watch a directory for certain types of files and move them to their appropriate location. The programmer wanted a utility that could intelligently figure out what type of file, and move it to where it needed to go. fsniper can detect these files when they are written, and can execute predefined actions on files that enter the monitored directory. Those actions are performed with Linux shell commands defined on configuration file or with scripts called from configuration file (typically normal bash scripts).

The configuration files for fsniper are normally located at ~/.config/fsniper/config file and it usually a good idea to put the file handling scripts also to the same directory. Fsniper comes with a self-explanatory example.conf (in source folder) which is a good starting point for configuration. Fsniper documentation, Fsniper Wiki and Distributing files with Fsniper give configuration examples how to do the configuration. If your Linux systems does not already had fsniper in it, download it and check also fsniper install instuctions.

fsniper uses inotify to monitor file changes, which enables it to react immediately and efficiently to changes of the file system (compared to┬átraditional cron jobs or bash scripts approaches on trying to react to those changes). This is an utility that you should check out if you use Linux and don’t know it already. It is really useful in many applications.


Be the first to post a comment.

Leave a Comment

Your email address will not be published. Required fields are marked *