You should check out Apache’s commons-io. It has a FileUtils class that will do what you want.
FileUtils.deleteDirectory(new File("directory"));
More Related Contents:
- How do you determine the ideal buffer size when using FileInputStream?
- Inserting text into an existing file via Java
- How to delete a folder with files using Java
- Write I/O file to shared network drive using credentials
- How to retrieve a list of directories QUICKLY in Java?
- Write byte array to file in java
- Writing object in text file
- How to move elements of Java ArrayList to file in java [closed]
- How to append text to an existing file in Java?
- How do I create a file and write to it?
- How do I create a Java string from the contents of a file?
- Scanner vs. BufferedReader
- How to read a specific line using the specific line number from a file in Java?
- Reliable File.renameTo() alternative on Windows?
- Loading a text file into a textarea
- Writing a file to sdcard
- Java byte array contains negative numbers
- Java: CSV File Easy Read/Write
- Forward slash or backslash?
- Writing to console and text file
- Java scanner not going through entire file
- Why is using BufferedInputStream to read a file byte by byte faster than using FileInputStream?
- Read CSV file column by column
- Whole text file to a String in Java
- Random printing order for System.out & System.err calls [duplicate]
- Copy entire directory contents to another directory? [duplicate]
- Java OutOfMemoryError in reading a large text file
- File.exists() returns false when file exists
- Java difference between FileWriter and BufferedWriter
- Reading a text file in java [closed]