Linux Fu: Easier File Watching

Linux Fu: Easier File Watching

It isn’t as versatile, but it is easy to use and covers a lot of common use cases where you want some action to occur when a file changes. There are several command line options:

The /_ placeholder gets the name of the first file that caused a trigger, although that doesn’t seem to work properly with -s. For example:

When one of the . A lot of editors make automatic backup of files, but if yours doesn’t it would be pretty simple to make an auto archive with , although, honestly, use or something if you want real version control:

This stores each version of testfile.txt in archive.zip along with a timestamp on the file name:

It was tempting to use /_ in this script, but it doesn’t seem to work with the -s option very well.

Source: hackaday.com