Test Delete a File/Check for File Lock before Deleting RRS feed

  • Question

  • I'm trying to come up with a method to check and see if there are any file locks within a folder before attempting to delete the folder. Reason being, if there is a lock on one file, it still will delete 99% of the other files, leaving it in essentially a corrupt state. Since this is a Windows share on a NetApp storage unit, I cannot easily check for a file lock on the server side. 

    The only option I can think of is to attempt to move each file to a different directory and then if one fails due to a file lock, move them all back. While this should work, I'm hoping for a less cumbersome/slow method. 

    Friday, October 18, 2013 4:23 PM


All replies