gpt4 book ai didi

java - 删除android中的zip文件夹

转载 作者:行者123 更新时间:2023-11-29 02:26:58 24 4
gpt4 key购买 nike

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..

最佳答案

在您的文件中使用 delete() 方法之后。filePath 是一个包含 zip 文件路径的字符串。

File file = new File(filePath);  

//必须检查删除是否为真。如果文件删除成功则为true

boolean deleted = file.delete();

关于java - 删除android中的zip文件夹,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51727052/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com