I'm using inotify-tools where i want a notification of file which has been created in recursive directories
Till here i'm succesfull
Now i want to get directory path where a file is been created/dumped in the recursive folders
for e.g abc.txt file is dumped in data/test folder
i want the path to be data/test/abc.txt
Below is the code im using in .sh file
inotifywait -m -r --format '%f' -e modify -e move -e create -e delete /var/www/cloud/data | while read LINE;
do
php /var/www/cloud/scannner/watcher.php;
done
Kindly please help me to get the path of a dumped file in recursive directories
Cheers
Use the
%w
modifier:To pass the output of inotifywait as an argument to a php script, which will read it for the
argv
variable you could do this:Otherwise, if you want the php script to read the output of inotifywait from the standard input, then you can just pipe to your script: