I've been Googling and Overflowing for a bit and couldn't find anything usable.
I need a script that monitors a public folder and triggers on new file creation and then moves the files to a private location.
I have a samba shared folder /exam/ple/
on unix mapped to X:\
on windows. On certain actions, txt files are written to the share. I want to kidnap any txt file that appears in the folder and place it into a private folder /pri/vate
on unix. After that file is moved, I want to trigger a separate perl script.
EDIT Still waiting to see a shell script if anyone has any ideas... something that will monitor for new files and then run something like:
#!/bin/ksh
mv -f /exam/ple/*.txt /pri/vate
I don't use ksh but here's how i do it with sh. I'm sure it's easily adapted to ksh.
If I understand correctly, you just want something like this?
This will result in a fair bit of io - stat() calls and the like. If you want rapid notification without the runtime overhead (but more upfront effort), take a look at FAM/dnotify: link text or link text
Advantages:
incron
due to pyinotify is pure Pythonautocmd.py:
Check incron. It seems to do exactly what you need.
File::ChangeNotify allows you to monitor files and directories for changes.
https://metacpan.org/pod/File::ChangeNotify