c# - How do I delete a directory recursively -


                 case "pwd":                         //    form1.clientconnect(clientid, clientmsg);                             sendupdate(clientid + " : " + clientmsg);                             sendmsg("257 " + "\"" + presentdironftp + "\"" + " current directory \r\n", ref outbuffer);                             break;                  case "dele":                             //delete file server , reply back.                             form1.clientconnect(clientid, clientmsg);                             sendupdate(clientid + " : " + clientmsg);                             clientmsg = clientmsg.substring(4).trim();                              sendmsg(deletefileforserver(rootdironsystem, presentdironftp, clientmsg), ref outbuffer);                             break;          private string deletefileforserver(string rootdironserver, string presentdirofftp, string filename)     {         //check seperator         thread othread = thread.currentthread;         lock (othread)         {             string root = filepath(rootdironserver, presentdirofftp, filename);             try             {                 fileinfo ofile = new fileinfo(root);                 if (ofile.fullname != "")                 {                     ofile.delete();                     return "250 delete command successful\r\n";                 }             }             catch (filenotfoundexception e)             {                 //form1.clientconnect(clientid, e.tostring());                 sendupdate(clientid + " : " + e.tostring());                 return "550 file not found, or no access.\r\n";             }             catch (ioexception e)             {                // form1.clientconnect(clientid, e.tostring());                 sendupdate(clientid + " : " + e.tostring());                 return "550 file not found, or no access.\r\n";             }            // form1.clientconnect(clientid, "error in deleteing file " + filename);             sendupdate(clientid + " : " + "error in deleteing file " + filename);             return "550 file not found, or no access.\r\n";         }     } 

how can delete folder recursively server command dele?i tried not working...thx added function deletes files how can change on??? thx verry much... dfsdfds f dsfsdfsdfsd fsdfds

try this

directory.delete(toppath, true); 

the second parameter says - deleting recurcive.


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -