Sample code to delete the Files and the Directories.
Namespace :
If Directory have the sub directories then,
Directory.Delete("C:\test\", True)
Delete Files:
File.Delete("C:\test\text.txt")
To delete multiple files from Directory,
string[] Files= Directory.GetFiles(@"c:\test\");
Namespace :
using System.IO;
Code:
Delete Directory:
Directory.Delete("C:\test\")
If Directory have the sub directories then,
Directory.Delete("C:\test\", True)
Delete Files:
File.Delete("C:\test\text.txt")
To delete multiple files from Directory,
string[] Files= Directory.GetFiles(@"c:\test\");
foreach (string filePath in Files)
File.Delete(filePath);
No comments:
Post a Comment