TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
John
NA
928
131.8k
FIle delete exception
Feb 9 2018 4:05 AM
string FilePath = @"D:\WebSite1\Folder\open.txt";
try
{
System.IO.File.CreateText(FilePath);
bool fileExist = false;
while (!fileExist)
{
FileInfo sFile = new FileInfo(@"D:\WebSite1\Folder\close.txt");
fileExist = sFile.Exists;
}
System.IO.File.Delete(@"D:\WebSite1\Folder\open.txt");
System.IO.File.Delete(@"D:\WebSite1\Folder\close.txt");
}
catch (Exception ex)
{
}
above code throws ex of The process cannot access the file 'D:\\WebSite1\\Folder\\open.txt' because it is being used by another process.
Reply
Answers (
1
)
Microsoft Certification
Message Preview with Number