Watch Folders...

Scovitch

New member
Joined
Nov 20, 2006
Messages
1
Programming Experience
5-10
Hi Folks

I have an application that watches a folder and if any file is placed in it etc it copies it off to two other folders and deletes the original.

Fiairly easy stuff, but now and again if a big file is 'saved' into the folder rather than just pasted to it, it is not picked up.

So, I can easily poll the folder using a timer etc but am having real issue getting it to realise something is sitting there ready to be actioned.

Do any of you have an idea as to what I can do to rectify this?

I am using the watchfolder.NotifyFilter to pick up pastes, renames etc etc

in Summary: How can I get my app to just act upon anything it finds in the watch folder at a given interval?

Any help would be greatly appreciated as our thick IT manager :mad: is cruising for a bruising over this and I so would hate to lose my job!


 
Add a 'backup' routine to your form that scans the directory on an interval and executes the double move and delete function.

Just setup a timer on the form with a large check interval, and in the Tick event, call the function that makes copies and deletes the orignally.

You should be aware that a file can appear before it is complete, so you many want to note the files presence in the tick event, then on the next tick event if the files size has not changed, call the move event. (The file size no changing would indicate the write is complete under most circumstances)
 
Back
Top