Is it possible to delete zip files?

Please help me with this. I have tried almost anything, but it seems impossible to delete a zip file from a directory with java. I have closed the zipInputStream, and done all other precautions I can think of. My code to delete now is:
zipFile.delete();
zipFile = null;
System.gc();
This works for other file types, but NOT zip files... Any suggestions?

If you just want to delete a .zip file you can treat it like any other file i.e
java.io.File file1 = new java.io.File("D:\\zip1.zip");
file1.delete();You can also create .zip files in the same way i.e.
java.io.File file1 = new java.io.File("D:\\zip1.zip");
file1.createNewFile();

Similar Messages

  • Problem in deleting Zip files unzipped using java.util.zip

    I have a static methos for unzipping a zip file. after unzipping the file when i am trying to delete that file using File.delete()its not getting deleted. but when methods like exist(). canRead(), canWrite() methods are returning true what can be the possible problem ? i had closed all the streams after unzipping operation Please go through the following code.
    public static boolean unzipZipFile(String dir_name, String zipFileName) {
    try {
    ZipFile zip = new ZipFile(zipFileName);
    Enumeration entries = zip.entries();
    while (entries.hasMoreElements()) {
    ZipEntry entry = (ZipEntry) entries.nextElement();
    // got all the zip entries here
    // now has to process all the files
    // first all directories
    // then all the files
    if (entry.isDirectory()) {
    // now the directories are created
    File buf=new File(dir_name,entry.getName());
    buf.mkdirs();
    continue;
    }// now got the dirs so process the files
    entries = zip.entries();
    while(entries.hasMoreElements()) {
    // now to process the files
    ZipEntry entry = (ZipEntry) entries.nextElement();
    if (!entry.isDirectory()){
    File buf=new File(dir_name,entry.getName());
    copyInputStream(
    zip.getInputStream(entry),
    new BufferedOutputStream(
    new FileOutputStream(buf)));}
    } catch (IOException e) {
    e.printStackTrace();
    return false;
    return true;
    now i am trying to call this method to unzip a zip file
    public static void main (String arg[]){
    unzipZipFile("C:/temp","C:/tmp.zip");
    java.io.File filer = new File("C:/tmp.zip");
    System.out.println (filer.canRead());
    System.out.println (filer.canWrite());
    System.out.println (filer.delete());
    Please tell me where my program is going wrong ?

    Thanks .. the problem is solved... i was not closing the Zip file .. rather i was trying to close all the other streams that i used for IO operaion ... thanks a lot

  • How to delete zip file in sftp server

    Hi Gurus,
    I am having one .zip file with data files inside on the sftp server. Can you please how to delete the .zip files in the sftp server. I am able to delete normal files by using 'rm' on sftp.
    And one more request my sftp is prompting for the password everytime, then i need to enter the password manually. Can any one suggest how to write in shell script to accept that.
    Thanks in advance.
    Regards
    Nagendra

    You might want to look into user equivalence and configure a certificate for ssh so it does not prompt for a password.
    It will also allow you to use sftp without a prompt for a password.
    On the server side:
    Edit /etc/ssh/sshd_config and remove the # from the following:
    RSAAuthentication yes
    PubkeyAuthentication yes
    AuthorizedKeysFile .ssh/authorized_keys
    Then restart the ssh server:
    /etc/init.d/sshd restart
    Login as the user for whom this is for:
    su - <username>
    mkdir .ssh
    chmod 700 .ssh
    On the client side:
    Run the following command:
    ssh-keygen -t rsa (omit password)
    Then use the following to copy the public key from the client to the
    corresponding login .ssh directory on the server side;
    scp .ssh/id_rsa.pub username@remote_host:.ssh/authorized_keys

  • Is it possible to delete a file that has been backed up?

    Hi,
    Before doing a backup with Time Machine, I forgot to tell it NOT to backup a certain file that is fairly large. Now that the backup is complete, this large file is on my external hard drive and is backed up. But I want to delete this file from the backup----is it possible to do this, or am I stuck with it backed up now?
    Thanks!

    yes, it's possible. select this file in finder and start TM. click on the "gears" action button in Finder's toolbar and select "delete all backups of this item".

  • How to delete zip files on iPhone

    I'm using Safari on iPhone 5S (iOS 8.1.3) to surf the web. Unfortunately, it downloaded a .zip file. I don't know how to delete it.
    I try to open it in a app and delete it in that app. However, opening the safari this file's still there.
    Thanks for your help.

    Hi, hduc.yds.  
    Thank you for visiting Apple Support Communities.  
    I understand that you are experiencing an issue with Safari for iOS.  I would recommend clearing all website data, force closing Safari and restart the phone.  One this is done test the results.  
    Clear information from your device
    To clear your history and cookies from Safari in iOS 8, tap Settings > Safari > Clear History and Website Data. In iOS 7 or earlier, tap Clear History and tap Clear Cookies and Data.
    To clear other stored information from Safari, tap Settings > Safari > Advanced > Website Data > Remove All Website Data.
    Safari web settings on your iPhone, iPad, or iPod touch
    Force an app to close in iOS
    -Jason H.  

  • Delete zip file

    Hi All,
    I am trying to delete a zip file after unzipping it.
    The zip file contains files and directories inside it.I could able to unzip it successfully but could not able to
    delete it after unzipping it.
    after unzipping iam calling file.delete() method.
    please someone help me with some code.
    any help is highly appreciated.

    Im just speculating but Im guessing you still have some other object that is "holding" the zip file and making it "taken/buissy" sort of say(some streams or other things perhaps), which would persumably make it impossible for your program and other programs etc to delete it during that time.
    Try and make all references to the zip file => null after your done with it, then delete.

  • Possible to delete Offline Files content for a specific user from the Client Side Cache (CSC) ?.

    Hello Everyone,
    We would like to implement a script to delete the offline files in the Client Side Cache (CSC) for a nominated user (on Windows 7 x64 enterprise).
    I am aware that;
    1. We can use a registry value to flush the entire CNC cache (for all users) next time the machine reboots.
    2. If we delete the user's local profile it appears that Windows 7 also removes their content from the local CSC.
    However, we would like to just delete the CSC content for a particular nominated user without having to delete their local user profile.
    In our environment we have many users that share workstations but only use them occasionally. We don't use roaming profile so we would like to retain all the users' local profiles but still delete the CSC content for any users that haven't
    logged on in a week.
    Any ideas or info would be appreciated !
    Thanks, Makes

    Hi,
    I don't think this is possible.
    If you want to achieve it via script, I suggest you post it in official script forum for more professional help:
    http://social.technet.microsoft.com/Forums/scriptcenter/en-US/home?category=scripting
    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.
    Karen Hu
    TechNet Community Support

  • Can i delete .zip files after extraction

    for example like after i download minecraft or do i have to keep it

    I kept it, as backup whenever mods go wrong.
    Please help.
    <https://discussions.apple.com/thread/4404594>
    -Bananana

  • How to read a Zip file in PL/SQL program

    Hi,
    I was Reading a ".csv" file from a web URL eg. "www.aba.com/zxc.csv" in my PL/SQL procedure using UTL_HTTP package and loading data in my DB.
    Now that file is in .zip format, is there any way that I can still read that .csv.zip file through my PL/SQL procedure. Because now I have to download it first then
    unzip it and then I am loading it into my DB using UTL_FILE package instead I want to do it automatically as I was doing it before when it was not zipped.
    Thanks & Regards
    Sanjay

    Peters solution is a great, nice alternative - you should consider it.
    But your present solution reads the data from the web using UTL_HTTP into a CLOB I presume? So you are not hitting the file system at all?
    If it is not an option for you to go to the file system, then it is possible that you can use [url http://docs.oracle.com/cd/E11882_01/appdev.112/e25788/u_compr.htm#BGBBCDDI]UTL_COMPRESS package.
    That is (maybe) a possibility if the zip file only contains one file - it cannot handle if the zip file is a zip archive with several files in it.
    You could try doing your UTL_HTTP load into a BLOB and then call UTL_COMPRESS.LZ_UNCOMPRESS to unzip that BLOB into another BLOB.
    I'm not guaranteeing it will work, but it may be worth a try if you cannot do it Peters way ;-)

  • Zip files with webstart

    Is there a way to have webstart download zip files to the client and allow them to be used in the trusted environment. Obviously I'm having a problem, since the zip file can't be signed like my jar's can.

    Is there a way to have webstart download zip files to
    the client and allow them to be used in the trusted
    environment.It is possible to download zip files into memory and use them there or write them to disk (if you have file write permissions in your sandbox).
    The posting on how to roll your own JRE (search this forum or the unofficial JWS FAQ) features an extension installer that grabs and decodes jar files from an URL. You could whack down that code for your use.
    Note that this file is downloaded by your app and not by the JWS class loader and thus needs no signing.
    Regards,
    Marc

  • Hi!  I have downloaded a ready-made website and I can't seem to open it.  The "theme" install instructions are talking about a "zip" file which I cannot see.  Would anyone know why I can't open it?  PLEASE HELP!!   Thanks!

    Hi Everybody
    I have downloaded three "ready-made" websites for me and it is supposed to have Wordpress in as well.  I can see the folders in my downloads but I can't open them.  It refers to a "zip" file which I don't see nor a "dmg", only a blue folder.   Can anyone help me to figure out how to get this open and set up on my computer?  I guess you can tell I'm new and very frustrated.  Thank you!

    It's not clear what you mean by 'see the folders in my downloads but I can't open them', although it seems possible that a zip file opened/unzipped to create them.
    Perhaps if you include a screenshot, and/or a link to the site where you got these, and describe exactly what happens when you try to open a folder that won't open.

  • Is it possible to delete files from time machine?

    Is it possible to delete files from time machine? I had a drive crash, restored the files to a new drive, and now the old versions and the new versions of the files are both backed up, taking up a mountain of drive space. Do I just have to wait 'til the drive gets full and then tell it what to delete first?

    Hi, I need help in a related problem. I have 500gb time capsule. I needed larger hard drive, so I now use TM to back up to a different 1tb hard drive. So I don't need the TC as a TM back up device. But I want to use the TC's hard drive as an extra external hard drive. I deleted the files that were on it. but it still shows it has a sparsebundle file with a size of over 400gb ( probably the size of the old backups). When I use disk utility to try to erase it, I am not offered the erase tab. This "disk" does show on the desk top as a mounted disk (I think) with only 53 gb free. How can I set this up so all the disk space is free and I can use it for storing files, not as a back up? Thanks

  • I have moved old Back Up files from my external hard drive to the trash and as the Trash previews the files, i.e. counts them (over 850,000 files) it then begins to delete but then stops. Is it possible to move the files out of the Trash file and then onl

    I have moved old Back Up files from my external hard drive to the trash and as the Trash previews the files, i.e. counts them (over 850,000 files) it then begins to delete but then stops. Is it possible to move the files out of the Trash file and then only delete a small amount at one time?

    See
    Deleting backups via the Finder on Lion 10.7.x or later:
    http://pondini.org/TM/12.html
    Hold option (alt) while emptying the Trash.
    See also
    http://pondini.org/TM/E6.html
    Message was edited by: WZZZ

  • How do I delete a Thunderbird. zip file that was created by recuvva?

    My Dell computer is over 10 years old and getting ready to be recycled. I have used Thunderbird since 2011 and the issue is a concern to an otherwise outstanding program.
    The file recover program RECUVVA created a file of all deleted Thunderbird emails called Thunderbird.ZIP. I have tried several software programs to delete the file (AVG, ERASER, Glary) and none will delete the Thunderbird.ZIP file file.
    The file has migrated from the Dell computer to other computers and external drives. I loaded a copy of Thunderbird.ZIP file on a small USB drive and the only way to delete this file was to overwrite the USB drive and then reformat it. I really do not want to reformat several hard drives to remove the Thunderbird.ZIP file.

    If you want to get rid of the computer.
    If the Recuva file cannot be deleted until it has been used to recover, then use it to empty it.
    Then uninstall Recuva to stop using it.
    Then delete emails you do not want, empty the Deleted and Junk folder and then compact all folders.
    Then if you want to migrate whole profile to another pc - make a backup file of Profile.
    If you uninstall Thunderbird, it will uninstall the Thunderbird Program, but it may not have removed your Thunderbird Profile containing emails etc.
    Make sure this has been fully deleted.
    http://kb.mozillazine.org/Profile_folder_-_Thunderbird
    If recycling/ selling/trashing the pc, I would recommend that you get everything you require off that pc and then reformat the hardrive.

  • Possible trojan .zip file in jar folder

    Has anyone heard of the possibility of an infected "jar" file in the
    J2SE v.1.4.2_03 application?
    I have recently installed Sun during an XP Pro install due to the regulations that don't allow Microsoft to monopolize the Java Machine anymore, and now I have received a message from my Virus software that the demo.jar-2e26db2e-6e6164b1.zip file residing in
    C:\Documents and Settings\Owner\Application Data\Sun\Java\Deployment\cache\javapi\v1.0\jar has been detected as an uncleanable trojan. It needs to replaced. Any bulletins about this or help in obtaining another file, (if it's needed to have the application function properly), would be appreciated.

    You can certainly remove that file. it's basically the cached applet demo.jar (the JRE caches the downloaded jars so that you don't have to keep re-downloading them each time you visit the web site).
    The fact that your Antivirus complains about it just means that it's confused. We're all using the Sun environment, and I have the latest and greatest Norton, and there are no complaints, so it's clear that your Antivirus software needs a fix.

Maybe you are looking for

  • Windows 8.1 will not get Forefront Client Updates from WSUS

    Recently I noticed that my Windows 8.1 clients were not getting updates from WSUS 3.2.  After some searching I found it was an issue with HTTPS and the solution was to disable HTTPS or enable TLS.  So I enabled TLS on the Server 2008 R2 WSUS server a

  • Create a work order using the BAPI for IW31

    Hi,       I want to create a work order using the BAPI for IW31 tr. can any one help me with the program description. Full points will be awarded for the useful answers. Thanks and regards, Sunil

  • SQL Developer - 1.5.5.59.69 - XP - Memory Leak

    I am running SQL Developer 1.5.5.59.69 in XP and I am having an issue with what seems to be a memory leak. I left SQL Developer running over night, and when I looked at the task manager, the memory usage was really high, and each time task manager re

  • How to create the multiple desktops

    Hi, Can anybody help me out how to create the multiple desktops in weblogic portal.After creating the desktops how to run them.Can you provide me the any document or send me the solution for it. I will be waiting for the reply.Thanks in advance.. Tha

  • Problem installing weblogic server 8.1

    WHAT COULD BE THE PROBLEM ? CAN ANYONE HELP ME OUT? <Aug 23, 2008 3:16:23 AM EDT> <Info> <WebLogicServer> <BEA-000377> <Starting WebLogic Server with Java HotSpot(TM) Client VM Version 10.0-b19 from Sun Microsystems Inc.> <Aug 23, 2008 3:16:24 AM EDT