Checking if file is in use by another process
I am trying to delete a file that gets moved to another folder.
If this file gets moved to the new folder, and meets certain criteria, I want to immediately delete the file.
However, I think the operating system is locking the file during the move, so when I delete it, I get the message...
The process cannot access the file "C:\myfile.txt" because it is being used by another process.
Is there any way I can run a loop checking if the file is no longer being used by another process, and then delete it?
Greg