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