File handling:
In any software application we need to do some following tasks:
- Create new Folder/File.
- Edit Folder/File.
- Delete Folder/File
For above type of work in our application we need to use File handling.
Generally we get all examples related to create and edit in lot of websites.
But How to delete the Folder/File It is not common So I am taking the example how to delete the Directory/File in C#.
Namespace: System.IO
Assembly: mscorlib (in mscorlib.dll)
This Programs is made for console application
//By: Raman
//Purpose: To delete the particular folder in your system
//Code Start
using System.IO;
class deleteFolder
{
protected void delFolder()
{
//delete folder has been created in E:\ drive you can make your any named folder
//Lets assume we have junk images stored in that folder
DirectoryInfo imgInfo = new DirectoryInfo(@"E:\delete");
FileInfo []fileinDir=imgInfo.GetFiles();
for(int i=0;i
{
fileinDir[i].Delete();
}
//delete method will delete the current file
imgInfo.Delete();
}
public static void
{
deleteFolder obj=new deleteFolder ();
obj. delFolder ();
}
}
//Code End
Any Query on file handling would be appreciated
* This program is used to delete the particular folder on your window. It could be destructive so please use it carefully
Can this be done in flex also. If yes then how?
ReplyDeleteHi Flextremist,
ReplyDeleteIt is possible to create files and folder in Adobe AIR for further details
you can visit to:
1.
http://help.adobe.com/en_US/AIR/1.1/devappshtml/WS5b3ccc516d4fbf351e63e3d118666ade46-7fe4.html
2.
http://labs.adobe.com/wiki/index.php/AIR:Articles:Adobe_AIR_Local_File_System_Access#Creating.2C_writing.2C_and_reading_a_binary_file
You must get solution for your question.
Thanks for your response
Regards
Raman
How can an excel file be read by the C#?
ReplyDeleteHi Gagan,
ReplyDeleteI have solved your problem in my post
"Execl to Folder ceation in file handling"
Hope this will solve your query.
Raman
Thanks dude...
ReplyDelete