【发布时间】:2018-08-07 12:40:26
【问题描述】:
Map<String, String> zip_properties = new HashMap<>();
zip_properties.put("create", "false");
URI zip_disk = URI.create(name);
/* Create ZIP file System */
try (FileSystem zipfs = FileSystems.newFileSystem(zip_disk, zip_properties))
{
Path pathInZipfile = zipfs.getPath(name);
// System.out.println("About to delete an entry from ZIP File" +
pathInZipfile.toUri() );
Files.delete(pathInZipfile);
//System.out.println("File successfully deleted");
} catch (IOException e) {
e.printStackTrace();
}
我已经为内部存储中的多个图像创建了 zip 文件夹。现在我想从该位置删除 Zip 文件并在 android 中重新创建同名 zip 文件夹。
Perform above code for delete zip folder but its not working
Please help me if anyone have solution
Thanks in advance..
【问题讨论】:
-
@RanjanDas 我试试你的代码,但它只删除 zip 文件的内容,但不删除 zip 文件。
-
给出 zip 文件的路径,而不是它的内容。
-
Zip_Folder_Path :: /storage/emulated/0/PhotoResizer/PhotoResizer_1533707372194.zip 我使用上述路径删除 zip 文件夹,但只删除 zip 文件夹的内容而不是 zip 文件。
-
只做arraylist.clear();在我的情况下,重新创建 zipfile。它解决了我的问题。谢谢。
标签: java android delete-file