2012-07-06 3 views
8

/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 
} 
+0

네 다음 문제가 무엇 사람 (초보자)를 도움이되기를 바랍니다 파일과 폴더를 삭제하려면? 그렇다면 그것을 선택하고 삭제할 수 있습니다. 프로그래밍 방식으로 수행하고 싶은 경우 –

+0

그런 방법으로 파일을 삭제할 수는 있지만 폴더는 삭제할 수 없습니다. @Arfin –

+2

DDMS에서 가져올 수 없으며 adb 셸에서 수행해야합니다. ** adb 쉘 rmdir/mnt/sdcard/폴더 ** – user370305

답변

7
C:\>adb shell 
$ rmdir /mnt/sdcard/Android/data/mydirectory/ 
1

사용하십시오 비어 있지 않은 폴더.

C:\> adb shell 
$ rm -r /mnt/sdcard/Android/data/mydirectory/ 

참고 : rmdir은 비어 있지 않은 폴더 만 삭제할 수 있습니다. 먼저 당신이 당신의 SDK를 \ 플랫폼-도구가 \있는 경로에 cmd를 간단한 이동을 통해 ADB 쉘에 가야 DDM의에서 폴더를 삭제하려면

11

방법에 대한 코드 아래의 sdcard에서 삭제 폴더에 대한 방법을 아래에

0
boolean success = (
new File("/data/data/yourpackege/New Folder")).delete(); 

if (!success) { 
     // Deletion failed Message 
Toast.makeText(getApplicationContext(),"not deleted : ", Toast.LENGTH_LONG).show(); 

}else{ 
Toast.makeText(getApplicationContext()," deleted : ", Toast.LENGTH_LONG).show(); 

} 
0

, 당신의 ADB 쉘

있다

그런 다음

를 사용하여 폴더를 삭제할 수 있습니다 먼저 간단하게

adb root 

를 입력하여 장치를 근절해야한다 폴더를 삭제하는 명령을 실행

0

rm -r /mnt/sdcard/folder 

당신이 DDMS 내부의 폴더를 볼 수 있습니다, 내 대답은

관련 문제