using System;
using System.IO;
class Test {
public static void Main()
{
string path = @"c:\temp\MyTest.txt";
using (StreamWriter sw = File.CreateText(path)) {}
string path2 = path + "temp";
// Ensure that the target does not exist.
File.Delete(path2);
// Copy the file.
File.Copy(path, path2);
// Delete the newly created file.
File.Delete(path2);
}
}
For Answers, see/post comments
Delete text file file
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment