I am trying to delete the contents of zip file but not the zip directory.I tried FileUtils.cleanDirectory(deteleOldZip)
, but got an error "abc.zip is not a directory".
Is there any other way to do in a single line?
Since you just want an empty zip file
String name = file.getAbsolutePath();
FileUtils.deleteDirectory(file)
Then create a new empty zip directory with the file path.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.