VideoHelp Forum

Our website is made possible by displaying online advertisements to our visitors. Consider supporting us by disable your adblocker or Try ConvertXtoDVD and convert all your movies to DVD. Free trial ! :)
+ Reply to Thread
Results 1 to 18 of 18
Thread
  1. Banned
    Join Date
    Jun 2004
    Location
    ®Inside My Avatar™© U.S.
    Search Comp PM
    Okay, here is my issue,

    I have around 1000 .zip files, give or take.
    Each zip file has 1 file inside of it.
    I want to delete the contents of each zip file while keeping the original zip file.

    Yes I know I can open each zip file and delete the contents while keeping the original zip file but empty, one at a time,
    but that would take forever!!

    Does anyone know of a program that will let be delete all the files inside all the zip files at once ?
    I want to keep the zip files the way they are named but just delete what is inside of them all.

    I tried to see if there was a way to do it in bulk within winzip but could not find a way.
    Also checked winrar and 7zip, but don;t see an option for what I want to do.

    Total Commander maybe ??

    Yeah, I know, I always come up with some crazy Q's no one seems to be able to answer....
    LOL!!!
    Quote Quote  
  2. On a Windows system I would use PKZIP in a batch file like

    for %%h in (*.zip) do pkzip -d %%h *.*
    Quote Quote  
  3. Member DB83's Avatar
    Join Date
    Jul 2007
    Location
    United Kingdom
    Search Comp PM
    But surely when you delete the contents of a zip file you effectively delete the archive file. Or to put it another way, you can not have an empty archive.

    I just tried it.
    Quote Quote  
  4. you can not have an empty archive.
    I can

    Click image for larger version

Name:	Empty.jpg
Views:	351
Size:	50.1 KB
ID:	20903
    Quote Quote  
  5. 7-zip (free, open source) has the ability too:

    One zip file:
    Code:
    7z d filename.zip *.*
    All zip files in a folder:
    Code:
    for %%h in (*.zip) do 7z d %%h *.*
    Warning: those will delete all files from the archives leaving empty zip files. If you only want to delete one particular file replace *.* with the name of the file you want to delete. For example, if you wanted to remove thumbs.db from each archive replace "*.*" with "thumbs.db".

    Code:
    for %%h in (*.zip) do 7z d %%h thumbs.db
    Quote Quote  
  6. Member DB83's Avatar
    Join Date
    Jul 2007
    Location
    United Kingdom
    Search Comp PM
    Ok. I only tried it manually within WinRar. Once the content was deleted, the .zip vanished from the folder.

    Well I am sure the OP has a good reason for doing this but, unless, again, I am mistaken, an empty archive is going to use the minimum allocated disk space set by the file-system which could somewhat defeat the purpose.
    Quote Quote  
  7. Yes, after 7-zip deleted all the files the remaining ZIP archive was 22 bytes. But it occupied a 4 KB cluster on the drive it was on, of course.
    Quote Quote  
  8. Banned
    Join Date
    Jun 2004
    Location
    ®Inside My Avatar™© U.S.
    Search Comp PM
    Okay, thanks everyone!!

    I have 7zip, always have, but it is not associated with zip files, I usually only use 7zip with 7zip files.

    So exactly how do I run it with a command line ?
    Do I need to run it in the same folder with the zip files ?

    It has a section in the help file on running command lines and I am going to read it now, but a step by step for dummies would be great

    EDIT:
    So I have the command line/window open,
    Click image for larger version

Name:	cmd.jpg
Views:	1333
Size:	125.3 KB
ID:	20909

    I have all the zip files in a folder in the root of C:
    Last edited by Noahtuck; 29th Oct 2013 at 14:54.
    Quote Quote  
  9. Member DB83's Avatar
    Join Date
    Jul 2007
    Location
    United Kingdom
    Search Comp PM
    If I learnt my previous lesson from jagabo correctly, you create a batch file with the command line inside it. Put the batch file somewhere you can find it and darg 'n drop your folder containing the .zip files on to it.
    Quote Quote  
  10. Banned
    Join Date
    Jun 2004
    Location
    ®Inside My Avatar™© U.S.
    Search Comp PM
    Okay, I have done stuff like that before, where you drag a folder or files into it and it does what it needs to do.
    But it has been so looong I don't have a clue.

    Man, you would think they would just include something in the menu to highlight and delete all the contents of all zip files.
    Last edited by Noahtuck; 29th Oct 2013 at 15:09.
    Quote Quote  
  11. Banned
    Join Date
    Jun 2004
    Location
    ®Inside My Avatar™© U.S.
    Search Comp PM
    Okay, never mind.

    I got it!!

    LOL!!!

    I made the text file with the command line you guys posted and renamed it .bat

    Deleted all the contents of the zip files so I still have all the zip files with their original names but they are now empty and take up 1.6mb instead of the 1gb they previously did.

    Thanks again!!
    Quote Quote  
  12. Noahtuck I am in need of the same thing as you would you care to share your .bat file? I tried making one (I have never done it before) it did not work. I have a bunch of zips I would like to empty and keep the file name of the zip so I can add to them later.
    Quote Quote  
  13. Be careful...

    Code:
    for %%h in (*.zip) do "c:\program files\7-zip\7z.exe" d "%%h" *.*
    EmptyAllZips.bat attached in a ZIP file. Edit the BAT file with Notepad to set the path to 7z.exe on your computer.
    Image Attached Files
    Quote Quote  
  14. Jagabo

    Thank you for your help.

    I changed the name of the BAT file to .TXT made the edit to C:\Program Files (x86)\7-Zip\7z.exe

    Changed the extension back to .bat and when i drag and drop the folder windows asks to run, I hit yes and the command window opens like it is going to do something and disappears. the zips are not empty.

    Any suggestions
    Quote Quote  
  15. ok I had to drop one zip file on the bat file not the folder!

    Works like a charm thank you so so much!
    Quote Quote  
  16. Originally Posted by DaveSehl View Post
    ok I had to drop one zip file on the bat file not the folder!
    Put the BAT file in a folder full of ZIP files. Then double click on the BAT file. All the zip files in that folder will be emptied.

    I tested on Win7. Behavior might be different in XP. If I remember correctly, the default folder when running BAT files in XP isn't the folder the BAT file is in but rather C:\Windows\System32. So the BAT file has to be modified for XP.

    By the way, you don't have to rename the BAT file to edit it with Notepad. If you enter *.bat or *.* in the filename field the dialog will show you the BAT file. Or navigate to the folder the BAT file is in and start typing the name of the file -- you'll see the name pop up. Or put a shortcut to Notepad.exe in your SendTo folder. Then when you right click on any file you can select Send To -> Notepad.exe.
    Last edited by jagabo; 24th Oct 2014 at 19:13.
    Quote Quote  
  17. jagabo, Thank you so much for reassuring that there still is some good left in people. You saved me approximately 200 hours of work that I did not have to lose.
    Quote Quote  
  18. Member Cornucopia's Avatar
    Join Date
    Oct 2001
    Location
    Deep in the Heart of Texas
    Search PM
    Call me stupid, but what is the purpose of having a bunch of empty files?

    Or if you for whatever reason really needed to do this, couldn't you just as easily create a batch file that saves the directory list, deletes all the (zip) files in the folder, and then creates empty zip files using the names from the list (whether directly, or by creating zero byte text files and renaming the extension)? It might be quicker.

    Scott
    Quote Quote  



Similar Threads