|
-
Feb 20th, 2004, 06:20 AM
#1
Thread Starter
Hyperactive Member
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
-
Feb 20th, 2004, 01:01 PM
#2
Sleep mode
-
Feb 20th, 2004, 01:06 PM
#3
Thread Starter
Hyperactive Member
Hi Pirate,
Thanks for the response. However catching the exception was not the problem.
Anyway, I just made a work around. If the file was in use, I marked it in the database for deletion.
Then when the app/service runs again it attempts to delete any files marked for deletion.
-
Feb 20th, 2004, 01:11 PM
#4
Sleep mode
Originally posted by greg_quinn
Hi Pirate,
Thanks for the response. However catching the exception was not the problem.
Anyway, I just made a work around. If the file was in use, I marked it in the database for deletion.
Then when the app/service runs again it attempts to delete any files marked for deletion.
Poor file . If it knew it's marked for deletion , it would add itself to startup menu ......
Good workaround btw .
-
Feb 21st, 2004, 05:52 AM
#5
Thread Starter
Hyperactive Member
Heheh, 
Well the files messed with me in the first place by not being deleted when they wanted to, so I had to take extreme measures !
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|