`
asdzheng
  • 浏览: 95211 次
  • 性别: Icon_minigender_1
社区版块
存档分类
最新评论

file.delete 无法删除 zip文件

阅读更多
用file.delete来删除文件时,有时会出现删除不成功现象,这时候你需要检查的是:
 
1:你的文件是否正确,可以用file.exist看一下返回结果

2:你当前是否有权限来删除这个文件

3:你的文件输入输出流是否已全部close掉

4:文件是否被哪个正在启动的程序应用到

一般这些情况都排除掉,file.delete都会正常删除。

我今天是下载下来一个zip包,用程序解压完毕后,流什么都已关闭,却一直删除不了。

后来跟进去ZIP的解压方法里面看了一下,原来是ZipFile这个类在最后没有close掉,把它Close掉后,就可以正常删除ZIP文件啦。
分享到:
评论

相关推荐

    delete_sharefile.zip

    请按照说明文档操作:1,将delete_sharefile.bat文件放入以下目录即可: C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp 2,关闭通知 3,打开cmd,输入: net share 看看是否为空,为空则说明...

    File Delete Absolutely v3.04.zip

    File Delete Absolutely专门用来将自己电脑上不用的机密文件彻底删除,不会被任何文件恢复工具所恢复。使你能够完全保护好自己的机密。 在当今社会中,人们越来越多地依靠计算机来办公。每个人也习惯于在计算机中...

    WEB文件在线管理与顽固强制删除工具

    File.php 文件在线管理与批量删除(功能强大谨慎使用) Del.php 指定删除目录 和 删除顽固目录(FTP无法删除的) delete.php 指定删除目录 和 删除顽固目录-高权限版(FTP无法删除的) 在线打包....

    MATLAB R2016b 支持Microsoft Visual Studio 2017补丁

    将相关文件复制到相应的matlab文件夹即可。 Log in to an account with appropriate permissions to overwrite files in your MATLAB installation. ... Delete the .zip file in the <MATLAB> folder.

    H2OUVE_100.0.9.2.zip

    -mcd -f|-k <ConfigID> Delete the specified config setting. -lmc [BIOS] -f|-k <ConfigID> Load the specified config setting from Multi-Config.(BIOS: optional, it use on Full type to set default ...

    ruamelmod:ruamel.std.zip文件已修改以进行加密

    这非常简单,它只是向API添加了一个额外的参数: def delete_from_zip_file ( self , pattern = None , file_names = None , password = None ): #Take extra parameter for password. """ zip_file can be...

    delete文件和目录

    使用java.io.File删除单个文件或者整个目录

    create--delete-copy-file.zip_拷贝文件夹

    1、实现文件夹创建、删除、进入。 2、实现当前文件夹下的内容罗列。 3、实现文件拷贝和文件夹拷贝(文件夹拷贝指深度拷贝,包括所有子目录和文件)。 4、实现指定文件的加密和解密。

    Java实现zp大文件解压、合并、复制、删除(30万文件大约2个小时)

    当解压合并结束后,程序将PROVINCE_DIR路径下的文件移动到DONE_FILE_PATH下,并且删除PROVINCE_DIR跟UN_ZIP_PATH下文件,这样保证程序每次运行PROVINCE_DIR文件夹下的文件跟UN_ZIP_PATH下的文件都是最新未处理过的,...

    ant.jar下载

    org.apache.tools.ant.types.FileSet org.apache.tools.ant.util.DOMUtils org.apache.tools.ant.util.Watchdog org.apache.tools.ant.AntClassLoader org.apache.tools.ant.BuildException org.apache.tools....

    pdfbox-2.0.17.zip pdf文件合并拼接

    pdf文件合并拼接 package com.zht; import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.List; import org.apache.pdfbox.io.MemoryUsageSetting; import...

    Octave.ML.patch.zip

    Download the zip file Extract the contents to the "..\ex?" folder for each programming exercise. Do not delete your existing lib folder or contents - just extract the files and let them overwrite the ...

    File access sample.zip

    This sample shows how to create, read, write, copy and delete a file, how to retrieve file properties, and how to track a file or folder so that your app can access it again. This sample uses Windows....

    FileOperate文件管理

    Rename/delete a specified file. Copy a specified file to another directory. Copy a specified directory (along with all sub-directories and files) to another directory. Encrypt/decrypt a specified file...

    VB编程资源大全(英文源码 文件)

    extensn.zip Show only Certain Extensions in a FileListBox<END><br>49,crlmla.zip Created, Last Modified, and Last Accessed<END><br>50,permdel.zip Permanently Delete a File<END><br>51,BldRnd....

    FileSystem.zip

    ② 此系统至少有:Create、delete、open、close、read、write等和部分文件属性的功能。 ③ 实现这个文件系统。 ④ 能实际演示这个文件系统。 ⑤ 基本上是进入一个界面(此界面就是该文件系统的界面)后,可以实现...

    jacob-1.18工具包.zip

    target.delete(); } System.out.println("另存为: " + pdfFile); // 另存为,将文档报错为pdf,其中word保存为pdf的格式宏的值是17 Dispatch.call(document, "SaveAs", pdfFile, 17); // 关闭文档 Dispatch....

    Ant 1.9.2 API (CHM格式)

    5.文件压缩,打包 //压缩为zip文件 1. Project prj=new Project(); 2. Zip zip=new Zip(); 3. zip.setProject(prj); 4. zip.setDestFile(new File("d:tempsrc.zip")); 5. FileSet fileSet=new FileSet(); 6. file...

    SM.zip_out

    file manager. delete the file if file date is out of date.

    edtftpj.zip

    file.delete(); log.info("Deleted local file copy"); // Shut down client log.info("Quitting client"); ftp.disconnect(); log.info("Example complete"); } catch (Exception e) { e....

Global site tag (gtag.js) - Google Analytics