You can delete files and folders recursively like this:
void deleteRecursive(File fileOrDirectory) {
if (fileOrDirectory.isDirectory())
for (File child : fileOrDirectory.listFiles())
deleteRecursive(child);
fileOrDirectory.delete();
}
More Related Contents:
- Android file chooser [closed]
- How to read file from res/raw by name
- How to programmatically move, copy and delete files and directories on SD?
- How do I serialize an object and save it to a file in Android?
- Android: How to open a specific folder via Intent and show its content in a file browser?
- Creating temporary files in Android
- Get Application Directory
- Android; Check if file exists without creating a new one
- Creating a directory in /sdcard fails
- Trying to create a file in Android: open failed: EROFS (Read-only file system)
- Android SAF (Storage Access FrameWork): Get particular file Uri from TreeUri
- How to pass a file path which is in assets folder to File(String path)? [duplicate]
- How can I get the size of a folder on SD card in Android?
- How to create/write file in the root of the Android device?
- Delete file from internal storage
- How to delete internal storage file in android?
- how to create a folder in android External Storage Directory?
- How app can access files on USB OTG storages in Android 6.0 (API level 23) without root?
- How can I display images from a specific folder on android gallery
- android ellipsize multiline textview
- Set transparent background of an imageview on Android
- Android: upgrading DB version and adding new table
- Listview Scroll to the end of the list after updating the list
- How to change the color of a CheckBox?
- Store Android SQLite
- Android List view layout Similar to Google play
- Android different EditText backgrounds for different states using shapes, selector or list
- On Android 8.1 API 27 notification does not display
- How to place an imageview on top of another imageview in android
- Android Multiple YouTube Videos in Activity