/mnt/sdcard/new
에서 특정 폴더를 제거해야합니다.DDMS에서 폴더 제거
Eclipse에서 DDMS가있는 폴더를보고 있습니다.
어떻게 특정 폴더를 제거 할 수 있습니까?
미리 감사드립니다.
// Deletes all files and subdirectories under dir.
// Returns true if all deletions were successful.
// If a deletion fails, the method stops attempting to delete and returns false.
public static boolean deleteDir(File dir) {
if (dir.isDirectory()) {
String[] children = dir.list();
for (int i=0; i<children.length; i++) {
boolean success = deleteDir(new File(dir, children[i]));
if (!success) {
return false;
}
}
}
// The directory is now empty so delete it
return dir.delete();
}
쓰기 호출 deleteDir() 당신은을 삭제 -r
매개 변수를 rm
명령을 사용할 수 있습니다
// Delete an empty directory
boolean success = (new File("directorypath")).delete();
if (!success) {
// Deletion failed Message
}
네 다음 문제가 무엇 사람 (초보자)를 도움이되기를 바랍니다 파일과 폴더를 삭제하려면? 그렇다면 그것을 선택하고 삭제할 수 있습니다. 프로그래밍 방식으로 수행하고 싶은 경우 –
그런 방법으로 파일을 삭제할 수는 있지만 폴더는 삭제할 수 없습니다. @Arfin –
DDMS에서 가져올 수 없으며 adb 셸에서 수행해야합니다. ** adb 쉘 rmdir/mnt/sdcard/폴더 ** – user370305