Deletes a specified file or folder.
Public static void delFolder (String dirPath) {try {dAllFile (dirPath); String fpath = dirPath; File mPath = new File (fpath); boolean tempFlag = mPath. delete ();} catch (Exception ex) {Write. debug ("" + ex. getMessage () ;}} public static boolean dAllFile (String fPath) {File myFile = new File (fPath); if (! MyFile. exists () {return false;} if (! MyFile. isDirectory () {return false;} String [] tList = myFile. list (); File tempFile = null; for (int I = 0; I <tList. length; I ++) {if (fPath. endsWith (File. separator) {tempFile = new File (fPath + tList [I]);} else {tempFile = new File (fPath + File. separator + tList [I]);} if (tempFile. isFile () {boolean tempFlag = tempFile. delete ();} if (tempFile. isDirectory () {dAllFile (fPath + "/" + tList [I]); delFolder (fPath + "/" + tList [I]); return true ;}} return false ;}