// Directoryinfo dir = new directoryinfo ("C :\\");
// System. Io. filesysteminfo [] fiis = dir. getfilesysteminfos ();
// If (FS [1] is directoryinfo)
//{
//// Fi [1] is a folder
//}
// If (FS [1] is fileinfo)
//{
//// FCM [1] is a file
//}
Private void operatorfilebtn_click (Object sender, eventargs E)
{
Fileinfo Fi = new fileinfo ("aa.txt ");
If (Fi. exists)
{
// Append information to the file
Using (streamwriter Sw = Fi. appendtext ())
{
Sw. Write ("this is the test information :::");
}
}
Else
{
// Create a file and write information
Using (streamwriter Sw = Fi. createtext ())
{
Sw. Write ("Create File ::");
}
}
}
Private void readbtn_click (Object sender, eventargs E)
{
Fileinfo Fi = new fileinfo ("aa.txt ");
If (Fi. exists)
{
// Read the file content
Using (streamreader sr = Fi. opentext ())
{
This. richtextbox1.text = Sr. readtoend ();
}
}
Fi. copyto ("D: aa.txt ");
Fi. Create ();
Fi. Delete ();
}