I need to use inotifywait to watch for a folder. Files come into that folder can be very large, that's why I use close_write and wait for the file to complete writing. However, I also want an event to be triggered when a file is renamed under the same folder. So what event should I watch for file rename? I looked at the inotifywait manual page and I didn't find what I am looking for. The inotify IN_MOVED_TO event seems the one I need but that's not inotifywait.
I also tried the moved_to, but first, it didn't trigger the event when file is renamed; second, if I have both close_write and moved_to, the moved_to might be triggered before close_write is triggered in case the file is very large. Thanks.
inotifywait --monitor --event close_write --format '%w%f %e %T' --timefmt '%F %T' $watchFolder
| while read eventOutput
do
echo "eventOutput is:" $eventOutput
done