I use linux mint and I want a text file to reflect the changes of files in a directory, it should contain the names of files that exist in the directory and add newly created files automatically. I referred some links and it said a good way to do it is by using the inotify-tools. I did look up on that and came up with this bash script.
#!/bin/sh
while inotifywait -qqe modify path-of-directory ; do
ls > path-of-text-file;
done
But it doesn't seem to work, Kindly guide me on how to go about it and is it enough if I just add this script to the list of start-up applications to keep it running all the time or should I use a crontab?
>redirection, the file will be overwritten on any change. – Seth May 29 '17 at 09:14