automatically creating multiple .zip archives?

kobalt

Weaksauce
Joined
Sep 14, 2006
Messages
126
I have about a 1000+ files - each needs to go into its own, individual .zip archive. Is there a free utility out there that would automate this process?
 
Each file in it's own separate zip? I guess you could make a batch file out of a directory dump.
Assuming you are on NTFS, have you considered just using the native file system compression?
 
Thank you for your suggestion, but that just would not do in this case. For anyone else stuck in this predicament, check out my post above:
 
You could also do it with some vbscript. I'll attach in case anyone needs. Might be something you want to automate and this would do the trick...

Code:
Dim sDest
Dim oShell
Dim oFSO
Dim oArgs 
Dim oFolder

 Set oArgs  = Wscript.Arguments.Named
 Set oFSO   = CreateObject("Scripting.FileSystemObject")
 Set oShell = CreateObject("WScript.Shell")
 
 sSource = oArgs.Item("src")
 sDest   = oArgs.Item("dst")
 
  If sSource = "" or sDest = "" Then  
    Wscript.echo "zipEachFile.vbs"
	Wscript.echo "Zips each file in /src and saves it in /dst"
	Wscript.echo "use /src:<some_dir> to specify the location of source files"
	Wscript.echo "use /dst:<some_dir> to specify the lcoation to save the zips"	
    cleanup
  End If
  
  If right(sSource,1) <> "\" Then sSource = sSource & "\"
  If right(sDest,1)   <> "\" Then sDest   = sDest   & "\"
  
  Set oFolder = oFSO.GetFolder(sSource)
  
  For each oFile in oFolder.Files
    zip sSource & oFile.Name, sDest, oFile.Name & ".zip"
	
  Next


Sub CleanUp
  If isObject(oArgs) then Set oArgs = Nothing
  If isObject(oFSO) then  Set oArgs = Nothing
    
  Wscript.Quit
End Sub

Function Zip(source, destination, zipName)
  Dim oFSO, oTemp
  Dim zipHeader
  zipHeader = "PK" & Chr(5) & Chr(6) & String( 18, Chr(0))
  
  Set oFSO  = CreateObject("Scripting.FileSystemObject")
  wscript.echo "saving " & destination & zipName
  Set oTemp = oFSO.OpenTextFile(destination & zipName, 2, True)
  oTemp.Write zipHeader
  oTemp.Close
  
  If isObject(oTemp) then set oTemp = Nothing
  
  Set oZip = CreateObject("Shell.Application")
  oZip.NameSpace(destination & zipName).copyHere source
  
  Set oZip = Nothing
    
End Function
 
With a free command line zip utility like this, you can zip each file in the current directory separately using one command like:

for /f "delims=" %i in ('dir /b /a-d *') do if not exist "%~ni.zip" zip "%~ni" "%i"

It's lame that MS doesn't provide a command line zip/unzip utility. Even the compress utility from the RK doesn't make standard zip files.
 
Windows is a GUI-based OS that happens to have a Command Prompt for some actions... who the hell needs command line stuff? :D

/me dons the flame-retardant suit...
 
Back
Top