How to do it...

Create a script called inotify_example.sh:

#! /bin/bashfolder=~/Desktop/abccdate=$(date +"%Y-%m-%d-%H:%M")inotifywait -m -q -e create -r --format '%:e %w%f' $folder | while read filedo    mv ~/Desktop/abc/output.txt ~/Desktop/Old_abc/${cdate}-output.txtdone

Get Bash Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.