Reputation: 303
I'm trying to move files from a UNIX/Windows directory over to a SharePoint directory via a batch file. I know that the command that I want to use is just a simple move g:\...\*.* z:\
but I do not want to try to move any file that is currently open. Is there a way to check if files in a directory are open/in use and then only perform the move on the non open files?
Upvotes: 0
Views: 713
Reputation: 3685
On Unix you could use fuser, on Windows Sysinternals handle utilities respectively to query what processes have a file open.
Bear in mind that both of those must be executed on a system which controls source filesystem, not on your copy machine.
General problem with this approach is that check-move operation is not atomic: you may never be sure that file status have not changed after you checked but before you start moving/copying, however if I correctly assume that you have a scenario with producer which puts something on your shared drive - to be consumed by Sharepoint, and you want to make sure it's 'baked' before you attempt move - then a common practice is to control this on producer side by moving it to shared resource only when work on it is completed. If you have no direct control over the producer you can achieve this by using utitilies mentioned above
Upvotes: 1