I am looking to monitor a directory for any new csv files written in to the directory.
The new csv files on creation will be appended with data.
Once the file is written and closed.
The file needs to be moved to a new directory.
Monitor dir: /tmp/test/test/
destination dir for copy : /tmp/test/test1/
I have done up the following script but when running it moves the whole directory instead of the file, please help
#!/bin/bash
inotifywait -m --format '%w%f' /tmp/test/test/ -e close | while read file;
do
mv "$file" "/tmp/test/test1/"
done
ifnotify also notifies on the local directory. When it does that you move the file.
You can modify the code to this to get it to work: