Unable to move file because it's being used by another process -- my program?
Posted
by joslinm
on Stack Overflow
See other posts from Stack Overflow
or by joslinm
Published on 2010-04-17T16:25:14Z
Indexed on
2010/04/17
16:33 UTC
Read the original article
Hit count: 171
My program is unable to File.Move
or File.Delete
a file because it is being used "by another process", but it's actually my own program that is using it.
I use Directory.GetFiles
to initially get the file paths, and from there, I process the files by simply looking at their names and processing information that way. Consequently all I'm doing is working with the strings themselves, right? Afterwards, I try to move the files to a "Handled" directory. Nearly all of them will usually move, but from time to time, they simply won't because they're being used by my program.
Why is it that most of them move but one or two stick around? Is there anything I can do to try freeing up the file? There's no streams to close.
© Stack Overflow or respective owner