File deletion in C#
-
Hi, I'm trying to manipulate files in a C# program, when I delete a file however I run in to problems. It seems the file isn't really deleted until my application exits. I've tried it through File.Delete() and FileInfo.Delete(), and it seems to make no difference. The problem comes when after I have deleted the file I rescan the folder using Directory.GetFiles() and the "deleted" file is still there, except I can't read it. Do I need to somehow flush my file deletion?? Thanks in advance.
-
Hi, I'm trying to manipulate files in a C# program, when I delete a file however I run in to problems. It seems the file isn't really deleted until my application exits. I've tried it through File.Delete() and FileInfo.Delete(), and it seems to make no difference. The problem comes when after I have deleted the file I rescan the folder using Directory.GetFiles() and the "deleted" file is still there, except I can't read it. Do I need to somehow flush my file deletion?? Thanks in advance.
-
Hi Gubber, did you opened the file before? Maybe there is still an open stream or somthing like this on the file. Maybe you should try to dispose the stream before? Regards Sebastian