Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Trying to zip a file

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,59964
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Trying to zip a file
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Trying to zip a file - 5/7/2008 9:02:53 PM   
  Manukon

 

Posts: 3
Score: 0
Joined: 5/7/2008
Status: offline
 
Hi all,

        I need to zip a file using VBScripting. I have a few codes but cannot understand those. Can anyone help me out?
 
 
Post #: 1
 
 RE: Trying to zip a file - 5/7/2008 11:56:50 PM   
  ebgreen


Posts: 4972
Score: 31
Joined: 7/12/2005
Status: offline
Yes we can help you out. Show us what you have tried and explain the problem you are having.

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to Manukon)
 
 
Post #: 2
 
 RE: Trying to zip a file - 5/10/2008 9:39:26 AM   
  yfki

 

Posts: 78
Score: 0
Joined: 12/12/2007
Status: offline
'Winzip Parameters
       ' -min run Winzip minimized
       ' -a Add
       ' -r Include Sub Directories
       ' -ex Compression Strength
       ' http://www.memecode.com/docs/winzip.html
   Set execObject = WshShell.Exec("%programfiles%\winzip\winzip32.exe -min -a -r -ex " &  strContentDestination & " " & strContentSourceDir)

(in reply to Manukon)
 
 
Post #: 3
 
 RE: Trying to zip a file - 5/12/2008 7:25:39 AM   
  Rischip


Posts: 502
Score: 2
Joined: 3/26/2007
Status: offline
Winzip has a command line add-on. Also there is a post here for "native" zipping if you are using xp or 2003.http://www.visualbasicscript.com/m_53086/tm.htm

< Message edited by Rischip -- 5/12/2008 7:26:39 AM >


_____________________________

Rischip
Author of - The Grim Linker

(in reply to yfki)
 
 
Post #: 4
 
 RE: Trying to zip a file - 5/22/2008 6:11:16 PM   
  Manukon

 

Posts: 3
Score: 0
Joined: 5/7/2008
Status: offline
This is the code that i have found

compress "C:\Folder\zip.doc","C:\Newfolder\zp.zip"
Sub Compress(Input,ZipFile)
Set Shell = CreateObject("Shell.Application")
Set fso=CreateObject("Scripting.FileSystemObject")
fso.CreateTextFile(ZipFile, true).WriteLine "PK" & Chr(5) & Chr(6) & String(18, 0) .........###################
Set ZipFile = Shell.NameSpace(ZipFile)
ZipFile.CopyHere Input
Do Until ZipFile.items.Count = 1
Loop
Set Shell = Nothing
Set FSO = Nothing
Set ZipFile = Nothing
end sub


The code works fine. But I don't know what the line marked with '#" means. It is something related to the header of a zip file. Can someone give me a thoroughdescription?

(in reply to Rischip)
 
 
Post #: 5
 
 RE: Trying to zip a file - 5/23/2008 1:39:07 AM   
  DiGiTAL.SkReAM


Posts: 1183
Score: 7
Joined: 9/6/2005
From: Florida, USA
Status: offline
As far as I know, the line:
fso.CreateTextFile(ZipFile, true).WriteLine "PK" & Chr(5) & Chr(6) & String(18, 0) .........###################

Should read:
fso.CreateTextFile(ZipFile, true).WriteLine "PK" & Chr(5) & Chr(6) & String(18, 0)

The .........################### on the end is nonsensical.

EDIT: ok, I just re-read your post, and figured out what you were asking.  Sorry.

This code:
fso.CreateTextFile(ZipFile, true).WriteLine "PK" & Chr(5) & Chr(6) & String(18, 0)
Creates a zip file with the appropriate header, so that we can append the actual data to it later on.  If you look at a normal zip file with a HEX editor, you will see that the first few characters are equiv. to the header being created by the line you referenced.
Once the file is actually creted, we can then open it and add items to it.

< Message edited by DiGiTAL.SkReAM -- 5/23/2008 1:43:05 AM >


_____________________________

"Would you like to touch my monkey?" - Dieter (Mike Meyers)

"It is better to die like a tiger, than to live like a pussy."
-Master Wong, from Balls of Fury

(in reply to Manukon)
 
 
Post #: 6
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Trying to zip a file Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts