から特定のフォルダーを削除する必要があります/mnt/sdcard/new
。
Eclipse で DDMS のフォルダーを見ています。
特定のフォルダーを削除する方法。
前もって感謝します。
rm
コマンドと-r
パラメータを使用して、空でないフォルダを削除できます。
C:\> adb shell
$ rm -r /mnt/sdcard/Android/data/mydirectory/
注:rmdir
空でないフォルダーのみを削除できます。
C:\>adb shell
$ rmdir /mnt/sdcard/Android/data/mydirectory/
SDカードからフォルダを削除するには、以下の方法を使用してください
// 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() メソッドを呼び出すためのコードの下に記述します
// Delete an empty directory
boolean success = (new File("directorypath")).delete();
if (!success) {
// Deletion failed Message
}
最初に ddms からフォルダーを削除する場合は、cmd を介して adb シェルに移動する必要があります。sdk\platform-tools\ があるパスに移動すると、adb シェルがあります。
フォルダを削除するためのコマンドを実行するには、最初に入力するだけでデバイスをルート化する必要があります
adb root
その後、次を使用してフォルダーを削除できます
rmdir /mnt/sdcard/folder
ファイルのあるフォルダを削除するには
rm -r /mnt/sdcard/folder
私の答えが誰にも役立つことを願っています(初心者)