Sunday, January 24, 2010

How to make a virus using c# to delete non empty folder

//you need to make a directory in E:\ named delete and put some files in it and they will be deleted
//after this program is run

using System.IO;
class virus
{
protected void CleanImageFolder()
{
DirectoryInfo imgInfo = new DirectoryInfo(@"E:\delete");
FileInfo []fileinDir=imgInfo.GetFiles();
for(int i=0;i
{
fileinDir[i].Delete();
}
imgInfo.Delete();
}
public static void Main()
{
virus obj=new virus();
obj.CleanImageFolder();
}
}

No comments: