Hi,
if you are able to move the already copied files into an archiv directory, I would do the following:
Rename the found file to a filename which will be never hit by incoming files (some tilde before and after, or somthing like that). This would serve as flag that the file is in progress.
Copy this file into the target directory. This may last some time.
After successful copy move the source file into the archive directory rolling back the initial filename change.
Rename the target file in the target directory back to the initial filename.
When you log every step you should be able to find out weired circumstances when this process terminates abnormally. And you can be sure that the file in the target directory will only be fetched when completely written. With the code above you can't guarantee that.
When you want you can also delete the source file in the source archiv.
Best regards
McA
In reply to Re: Monitor directory for new files and copy only new files to another directory
by McA
in thread Monitor directory for new files and copy only new files to another directory
by JasonVoorheez
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |