I created several folders in the sdcard (Eclipse) by running an Android application in the emulator. Now I want to delete the folders which I have created on the sdcard.
I am able to delete files in the folders but I could not delete the folders in the sdcard.
How can I do this? Is there a way to delete folders?
Delete folders or files on a microSD card: Note: On older devices you'll need to first select All Files and then select the SD Card option. Note: To delete files or folders, long press on the item you wish to remove, and select the Delete option in the top right of the screen.
▶ The file system of SD card partition is corrupted. If so, your SD card might be protected by adding read-only attributes to all files. Thus, you are not allowed to delete files.
Tap or click to open File Explorer. Select the library where you want to remove a folder. Tap or click the Library Tools tab, and then tap or click Manage library. In the dialog box that appears, select the folder you want to remove, tap or click Remove, and then tap or click OK.
Using adb command you can delete folders.
click Run - > CMD-> type adb shell --> cd sdcard -> rmdir {dirname}
Note : Make sure your dir should be empty.
For non-empty directory use.
click Run - > CMD-> type adb shell --> cd sdcard -> rm -r {dirname}
Well, answer from Brijesh Thakur is really helpful.
I just tried this and it worked fine for me to some extent. I would like to mention that if your directory contains any files then the rmdir
command will not work. You will have to use rm -r
command for that.
To make it more easy for beginners I am explaining the process as follows.
First you need to locate your adb folder, mine was at D:\Android SDK\platform-tools>
Now execute adb shell
in a command prompt as:
D:\Android SDK\platform-tools>adb shell
A hash (#) symbol or dollar sign ($) will appear, then enter the following command:
# cd sdcard
Now you are in the sdcard of the device. If your folder is a sub folder then further locate its parent folder using the cd
command. Finally, use the rm -r
command to remove the folder recursively as follows. This will delete all files and directories in the folder.
# rm -r FolderName
Please note that if you want to remove a single file you can use the rm
command only and then the file name (with extension probably). And you can also use rmdir
command if the directory you trying to delete is empty.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With