M
Matt Harrison
I don't even really know how to describe this problem. I know what I
want the end result to be, but I've run into a dead end trying to figure
out possible solutions.
I've got a script which looks for files of a given type in a directory,
processes them, then moves the result elsewhere and removes the sources.
Currently, if I add another file to the directory while the script is
running, it will not be noticed (I'm using a simple directory read).
I would like to be able to add file while the script is busy and have it
append the new filename to its list. I've considered inotify type
monitoring but I don't know much about it and if it could be made to fit
this single-threaded script.
I've also thought about re-reading the directory after each file
operation is complete, and adding the previously unknown filenames to
the list.
I'm just not sure which way I should begin looking, if there's a good
solution for this already out there, or...what.
Thanks for some input
want the end result to be, but I've run into a dead end trying to figure
out possible solutions.
I've got a script which looks for files of a given type in a directory,
processes them, then moves the result elsewhere and removes the sources.
Currently, if I add another file to the directory while the script is
running, it will not be noticed (I'm using a simple directory read).
I would like to be able to add file while the script is busy and have it
append the new filename to its list. I've considered inotify type
monitoring but I don't know much about it and if it could be made to fit
this single-threaded script.
I've also thought about re-reading the directory after each file
operation is complete, and adding the previously unknown filenames to
the list.
I'm just not sure which way I should begin looking, if there's a good
solution for this already out there, or...what.
Thanks for some input