아래 그림과 같이 :
// 폴더 삭제 개인 static void deleteDirectory (file file) {if (file.isfile ()) {// 파일이 폴더 파일이 아님을 나타냅니다. 폴더 file.delete ();} else {// 먼저 현재 경로 문자열을 얻습니다 [] childfilepaths = file.list (); for (string childfilepath : filefile = newfile = news) file (file.getabsolutepath ()/"/" + childfilepath); deletedirectory (childfile);} file.delete ()} public static void main (String [] args) {file del_file = new File ( "d :/edcre/ibs" + "/temp/"); deletedirectory (del_file);Java에서 지정된 폴더 (이 폴더 포함)에서 모든 내용을 삭제하는 위의 방법은 편집기가 공유하는 모든 컨텐츠입니다. 나는 그것이 당신에게 참조를 줄 수 있기를 바랍니다. 그리고 당신이 wulin.com을 더 지원할 수 있기를 바랍니다.