
Are you copying files over, or are you moving them? 1. Moving them is easiest. Just move whatever you find, and use a sensible target filename. 2. Copying them is harder. Filename, timestamp, size, md5sum can be used to decide if you already have them. -- William On Fri, Feb 17, 2017 at 03:41:39PM -0500, Stewart C. Russell via talk wrote:
I need to watch a folder on a network share (a scanner) and see when new files are created. There are a couple of special things about this location:
* It's over CIFS. There's nothing I can do about that. I think that means I can't use Inotify.
* It doesn't have an accurate clock for timestamping. There's nothing I can do about that, either.
* If the share is being written to by the device, it effectively disappears: stat() complains loudly.
* It reuses the lowest available file name of the form ???EPSON%03d.(PDF|JPG)???, so synching the share to a sensible filesystem might overwrite files accidentally.
* I don't need to watch it very often; a few times per hour would be fine.
I tried using Perl's File::ChangeNotify::Watcher, which is supposed to pick the smartest method available. Unfortunately, this seems to be calling stat() every two seconds, resulting in:
1. Messages (one per existing file on the share) saying that the scanner has deleted them. This happens when someone starts scanning
2. An error message from stat() every two seconds while the device is scanning
3. Messages saying that all of the old files (plus the new one) have been created.
I was naïvely hoping for a mechanism that would report ???Hey, you have a new file called $filename??? but that seems to have been a pipedream. What do People Who Actually Know What They're Doing use, please?
cheers,
Stewart
--- Talk Mailing List talk@gtalug.org https://gtalug.org/mailman/listinfo/talk