Skip to main content

How to check wether a file/folder is been copying from one loc to another?

No replies
Joined: 2009-03-27
Points: 0

My work flow is :-
1) I have an Inbox, Outbox and Thrashbox.
2) My application continuously polls the Inbox. checks the contents of Inbox, if a valid file/folder is present, does some processing and moves it to Outbox, whereas if not a valid file, the moves it to Thrash.

My problem:-
1) My application is running.
2) User puts the a huge folder (size > 100 MB) inside Inbox. The Copying process is still not completed.
3) My application checks this folder, and as it is not valid, throws to thrash box.

To avoid this, i have put a check:-
1) Initially i calculate the length of the folder ( Here i use>length() method and in case of folders, recursively all child files length is added to the folder size).
2) Then if a file is not valid, i sleep the application for 15 secs.
3) Then again calculate the length of folder by same method as mentioned in (1)
4) compare the two lengths. If same, move to trash and if not same, again validate it.

But this check does not work properly as when copying process is on, the folder size shown is same.

Please let me know if any workarounds are possible???