Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Re: Adding files to a zip file

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

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Re: Adding files to a zip file
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: <<   < prev  1 [2]
Login
Message << Older Topic   Newer Topic >>
 Re: Adding files to a zip file - 4/3/2005 11:46:25 AM   
  token

 

Posts: 1917
Score: 0
Joined: 1/14/2005
From:
Status: offline
Check out the following URL.

http://www.memecode.com/docs/winzip.html

You can then simply use shell.run(winzip ......) to unzip the file.

(in reply to mzohreh)
 
 
Post #: 21
 
 Re: Adding files to a zip file - 4/3/2005 7:31:07 PM   
  buffi

 

Posts: 87
Score: 0
Joined: 3/28/2005
From:
Status: offline
Thanks token
I will have a look on that

(in reply to mzohreh)
 
 
Post #: 22
 
 Re: Adding files to a zip file - 4/3/2005 7:46:59 PM   
  token

 

Posts: 1917
Score: 0
Joined: 1/14/2005
From:
Status: offline
You are welcome.

(in reply to mzohreh)
 
 
Post #: 23
 
 Re: Adding files to a zip file - 4/3/2005 8:44:52 PM   
  buffi

 

Posts: 87
Score: 0
Joined: 3/28/2005
From:
Status: offline
Can anybody tell me what am i doing wrong.

      
Thanks

(in reply to mzohreh)
 
 
Post #: 24
 
 Re: Adding files to a zip file - 4/4/2005 6:05:23 AM   
  kirrilian


Posts: 628
Score: 3
Joined: 3/15/2005
From:
Status: offline
quote:
Originally posted by token

Is it compatible with the "regular" zip file format ? I would prefer it to be compatible to be of any use. And its free I assume ? =)



yes and yes :)

it also has its own zip format which is quite a bit better than the standard zip if you want to use that.

(in reply to mzohreh)
 
 
Post #: 25
 
 Re: Adding files to a zip file - 4/4/2005 6:09:35 AM   
  kirrilian


Posts: 628
Score: 3
Joined: 3/15/2005
From:
Status: offline
quote:
Originally posted by buffi

Can anybody tell me what am i doing wrong.

      
Thanks



change that line to:

      

your quotes werent balanced. not sure if the winzip command will work right since i dont have it installed to test it.

(in reply to mzohreh)
 
 
Post #: 26
 
 Re: Adding files to a zip file - 4/4/2005 6:20:30 AM   
  token

 

Posts: 1917
Score: 0
Joined: 1/14/2005
From:
Status: offline
Replace:

iRC = oShell.Run("winzip32 -e "repsys"&sDate&.zip" c:\graphs,1,True)

with:

iRC = oShell.Run("winzip32 -e "repsys" & sDate& & ".zip " c:\graphs,1,True)

If you include sDate within the quote, it will be treated as literal string instead of a variable.

(in reply to mzohreh)
 
 
Post #: 27
 
 RE: Re: Adding files to a zip file - 7/24/2005 1:25:09 PM   
  dazncat

 

Posts: 2
Score: 0
Joined: 7/23/2005
From: Canberra, Australia
Status: offline
Hi all Hope you can help.
This will probably be a no brainer for a lot of you but I am at my wits end.

I have been using the code from previously (shown below) and it worked really well until I started using folders that have spaces in them eg: d:\Work Stuff. If i replace the space with an underscore all works again. This I can not do due to the large changes invovled all over the system. I have modified the code and tried numerous ways to change it but get no where.

Help please.

Here is the snippet I have at this time

dim srcDir, destFile, sDate
sDate = day(date) & "_" & month(date) & "_" & year(date)
srcDir = "D:\Work Script Stuff\*.*"
destFile = "D:\Work Script Stuff\" & sDate & ".zip"

Set oShell = CreateObject("WScript.Shell")

Set execObject = oShell.Exec("%programfiles%\winzip\winzip32.exe -min -a -ex " &  destFile & " " & srcDir)
Do Until execObject.StdOut.AtEndOfStream
 strLine = execObject.StdOut.ReadLine()
  WScript.Echo strLine
Loop
set oShell = nothing

Hope some one can help

Many Thanks in advance


_____________________________

Is it the weekend yet???

(in reply to token)
 
 
Post #: 28
 
 RE: Re: Adding files to a zip file - 7/24/2005 6:38:26 PM   
  ehvbs

 

Posts: 2106
Score: 50
Joined: 6/22/2005
From: Germany
Status: offline
Command line parsing depends on space(s) used as delimiters. So to pass a directory or
a full file specification containing spaces as one argument you have to quote them.

Change:

  srcDir = "D:\Work Script Stuff\*.*"
  destFile = "D:\Work Script Stuff\" & sDate & ".zip"

To:

  srcDir = """D:\Work Script Stuff\*.*"""
  destFile = """D:\Work Script Stuff\" & sDate & ".zip"""

(Two double quotes in a string literal result in just one double quote)

(in reply to dazncat)
 
 
Post #: 29
 
 RE: Re: Adding files to a zip file - 7/24/2005 10:13:24 PM   
  dazncat

 

Posts: 2
Score: 0
Joined: 7/23/2005
From: Canberra, Australia
Status: offline
Thanks for your response ehvbs

I will give it a go.

Well it worked thanks, I had looked at using the double quotes eg "" but that would mean it was expecting a statement between, but did not think of using the three sets of quotes """.

A trap for young players.

Thanks so much for your help and the work you and many others do here. Especially for those newbies at scripting such as myself.

I hope one day my knowledge will be as good as what I read here.

Anyway thanks again to you and everyone else

< Message edited by dazncat -- 7/24/2005 10:22:19 PM >

(in reply to ehvbs)
 
 
Post #: 30
 
 RE: Re: Adding files to a zip file - 5/28/2008 3:44:44 AM   
  BDIntern

 

Posts: 32
Score: 0
Joined: 5/19/2006
Status: offline
This is an old thread but I stumbled across it and found exactly what I needed!

The only thing that would be of great help is if I could zip up only the files that are 7 days old or older, is that possible? If so could someone point me in the right direction?

Thanks!

_____________________________

"640k ought to be enough for anybody"
-Bill Gates

(in reply to mzohreh)
 
 
Post #: 31
 
 RE: Re: Adding files to a zip file - 5/28/2008 4:00:52 AM   
  ebgreen


Posts: 4613
Score: 31
Joined: 7/12/2005
Status: offline
You would just need to check the LastModifiedDate on each file before adding it to the zip file.

_____________________________

"... 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 BDIntern)
 
 
Post #: 32
 
 RE: Re: Adding files to a zip file - 5/29/2008 4:41:11 AM   
  BDIntern

 

Posts: 32
Score: 0
Joined: 5/19/2006
Status: offline
Could I use an "if" statement and do something like:

If LastModifiedDate >= 7 Then
   Set oShell = CreateObject("WScript.Shell")
   iRC = oShell.Run("winzip32 -m " & DestinationPath & " " & SourcePath, 1, True)
   Set oShell = Nothing
End If

Well I just tried that and it ran through with no errors, but didn't move any files...

Sorry I'm not very good with vbscript, any help would be greatly appreciated!

_____________________________

"640k ought to be enough for anybody"
-Bill Gates

(in reply to ebgreen)
 
 
Post #: 33
 
 RE: Re: Adding files to a zip file - 5/29/2008 5:41:50 AM   
  ehvbs

 

Posts: 2106
Score: 50
Joined: 6/22/2005
From: Germany
Status: offline
Hi BDIntern,

look up the DateDiff function in the VBScript Docs and use it to check whether
the difference (counted in days) between Today (Date()) and the file's DateLastModified
property is greater (greater equal) than 7.

Good luck!

ehvbs

(in reply to BDIntern)
 
 
Post #: 34
 
 RE: Re: Adding files to a zip file - 5/29/2008 5:44:12 AM   
  BDIntern

 

Posts: 32
Score: 0
Joined: 5/19/2006
Status: offline
Thanks I'll look it up!

_____________________________

"640k ought to be enough for anybody"
-Bill Gates

(in reply to ehvbs)
 
 
Post #: 35
 
 
Page:  <<   < prev  1 [2]
 
  

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 >> Re: Adding files to a zip file Page: <<   < prev  1 [2]
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