Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > microsoft.public.scripting.vbscript > #11461

Re: VB Script for creating zip file and copying files into it.

Newsgroups microsoft.public.scripting.vbscript
Date 2016-11-29 19:49 -0800
References <272535d3-23c0-44b7-bcdf-b99ede1fad18@googlegroups.com><583be929$0$21473$e4fe514c@news.xs4all.nl><6b6acec6-bf5a-401b-b4de-86713f6d3b95@googlegroups.com><583c0ac9$0$21397$e4fe514c@news.xs4all.nl><74a5c05c-e698-4286-ac91-6139c6b27f4e@googlegroups.com><583c1289$0$21413$e4fe514c@news.xs4all.nl><0bf6b357-ef5d-4242-992d-bca114e4810a@googlegroups.com><583c54ef$0$21511$e4fe514c@news.xs4all.nl><fa9fa6c3-3da5-433a-8fdb-77497f96c443@googlegroups.com> <583d2d63$0$21404$e4fe514c@news.xs4all.nl> <c7544106-b88c-4e7b-baeb-ad52c0407bc9@googlegroups.com> <583d5eb3$0$21399$e4fe514c@news.xs4all.nl>
Message-ID <8342c826-ae94-40d9-90ba-e1f24f311ebf@googlegroups.com> (permalink)
Subject Re: VB Script for creating zip file and copying files into it.
From Chitra Balasubramani <chitrabala274@gmail.com>

Show all headers | View raw


On Tuesday, 29 November 2016 16:25:49 UTC+5:30, R.Wieser  wrote:
> Chitra,
> 
> > Yes the problem is "CopyHere" failing for the empty zip created manually.
> 
> I hope you remembered to disable the (re-)creating of the .ZIP file when you
> did that (also, add the "close" command.  It may not help, but it won't hurt
> either) ?
> 
> As a (very) last test, what happens when you try to CopyHere a simple
> textfile into the (manually) created .ZIP file ?
> 
> If that fails I'm really outof ideas I'm afraid.
> 
> .. Nope, one more: try changing.
> 
> Set ts = fso.OpenTextFile("C:\apace-jmeter-3\bin\Results\outcome.zip", 2,
> True)
> 
> to
> 
> Set ts = fso.CreateTextFile("C:\apace-jmeter-3\bin\Results\outcome.zip")
> 
> 
> I just did something I should have done long before: I ran your script on my
> XPsp3 machine.  And after adding a "Sleep" at the end it copied a folder to
> the created .ZIP file without a problem.    And that means I am *really*
> outof ideas.
> 
> I almost get the feeling as if something else is interfeering with the
> copying process.  Like an AV product perhaps ...
> 
> Regards,
> Rudy Wieser
> 
> 
> 
> Chitra Balasubramani <chitrabala274@gmail.com> schreef in berichtnieuws
> c7544106-b88c-4e7b-baeb-ad52c0407bc9@googlegroups.com...
> > On Tuesday, 29 November 2016 12:55:25 UTC+5:30, R.Wieser  wrote:
> > > Chitra,
> > >
> > > > Yes Chitra is my first name :)
> > >
> > > :-) I was asking because you adressed me by my sirname, making me wonder
> if
> > > I was talking to someone in a region where the persons own name is
> written
> > > last, and the sirname first.
> > >
> > > > Have tried below options :
> > > > 1. Copying those files to folder instead of zip. - Worked
> > > > 2. Copying files to empty zip which was created manually - Access
> Denied
> > > error.
> > >
> > > That seems to indicate that the sourcefiles are not the problem.
> > >
> > > > And also if manually copy files to the same empty zip file, it is
> > > allowing.
> > > >
> > > > And answer to your question, after running script, Zip is empty.
> > >
> > > That means that the (empty) ZIP file itself is of the right structure.
> > >
> > > Could you test what happens when you try to CopyHere to a .ZIP file you
> > > created manually (not by script) ?
> > >
> > > If that does *not* work than I am out of ideas I'm afraid.
> > >
> > > If it works its possible that the .ZIP file is not actually closed
> before
> > > you try to CopyHere to it.  In that case putting a "sleep" between ...
> Hold
> > > the presses!
> > >
> > > I just took another look at the code you posted, and only now noticed
> > > something I should have much earlier: where do you *close* the .ZIP file
> > > after you've created it ?
> > >
> > > Try adding "ts.close" just below the "Set ts = fso.OpenTextFile(...)"
> line
> > > and see what happens.
> > >
> > > Explanation: If the file is still open when the CopyHere command tries
> to
> > > access it (trying to open it itself) it won't work.
> > >
> > > Hope that helps,
> > >
> > > Regards,
> > > Rudy Wieser
> > >
> ...
> >
> > Rudy,
> >
> > Yes the problem is "CopyHere" failing for the empty zip created manually.
> >
> > Thanks,
> > Chitra

I tried the below code as well. Getting Access denied error. 

Set fso = CreateObject("Scripting.FileSystemObject")
Set ts = fso.CreateTextFile("C:\apace-jmeter-3\bin\Results\outcome.zip", True)
ts.Write "PK" & Chr(5) & Chr(6) & String( 18, Chr(0) )
WScript.Sleep 5000
ts.Close
Set fso = nothing
Set ts = nothing
WScript.Sleep 5000

Set objShell = CreateObject("Shell.Application")
Set DestFldr=objShell.NameSpace("C:\apache-jmeter-3.02\bin\Results\temp.zip")
Set SrcFldr=objShell.NameSpace("C:\Users\chitra.balasubramani\Desktop\Mail")
DestFldr.CopyHere (SrcFldr.Items)
WScript.Sleep 5000

Thanks,
Chitra

Back to microsoft.public.scripting.vbscript | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

VB Script for creating zip file and copying files into it. Chitra Balasubramani <chitrabala274@gmail.com> - 2016-11-27 22:57 -0800
  Re: VB Script for creating zip file and copying files into it. "R.Wieser" <address@not.available> - 2016-11-28 09:24 +0100
    Re: VB Script for creating zip file and copying files into it. Chitra Balasubramani <chitrabala274@gmail.com> - 2016-11-28 02:25 -0800
      Re: VB Script for creating zip file and copying files into it. "R.Wieser" <address@not.available> - 2016-11-28 11:48 +0100
        Re: VB Script for creating zip file and copying files into it. Chitra Balasubramani <chitrabala274@gmail.com> - 2016-11-28 02:47 -0800
          Re: VB Script for creating zip file and copying files into it. "R.Wieser" <address@not.available> - 2016-11-28 12:21 +0100
            Re: VB Script for creating zip file and copying files into it. Chitra Balasubramani <chitrabala274@gmail.com> - 2016-11-28 04:07 -0800
              Re: VB Script for creating zip file and copying files into it. "R.Wieser" <address@not.available> - 2016-11-28 17:04 +0100
                Re: VB Script for creating zip file and copying files into it. Chitra Balasubramani <chitrabala274@gmail.com> - 2016-11-28 20:06 -0800
                Re: VB Script for creating zip file and copying files into it. "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-11-29 08:16 +0100
                Re: VB Script for creating zip file and copying files into it. Chitra Balasubramani <chitrabala274@gmail.com> - 2016-11-29 02:36 -0800
                Re: VB Script for creating zip file and copying files into it. "R.Wieser" <address@not.available> - 2016-11-29 08:28 +0100
                Re: VB Script for creating zip file and copying files into it. "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-11-29 08:47 +0100
                Re: VB Script for creating zip file and copying files into it. "R.Wieser" <address@not.available> - 2016-11-29 08:59 +0100
                Re: VB Script for creating zip file and copying files into it. Chitra Balasubramani <chitrabala274@gmail.com> - 2016-11-29 01:37 -0800
                Re: VB Script for creating zip file and copying files into it. "R.Wieser" <address@not.available> - 2016-11-29 11:58 +0100
                Re: VB Script for creating zip file and copying files into it. Chitra Balasubramani <chitrabala274@gmail.com> - 2016-11-29 19:49 -0800
                Re: VB Script for creating zip file and copying files into it. "R.Wieser" <address@not.available> - 2016-11-30 08:53 +0100
                Re: VB Script for creating zip file and copying files into it. Ulrich Möller <knobbi38@arcor.de> - 2016-11-30 13:53 +0100
  Re: VB Script for creating zip file and copying files into it. "Dave \"Crash\" Dummy" <invalid@invalid.invalid> - 2016-11-29 11:56 -0500
  Re: VB Script for creating zip file and copying files into it. Gloops <gloops@zailes.invalid.org.invalid> - 2016-12-19 13:40 +0100
    Re: VB Script for creating zip file and copying files into it. Gloops <gloops@zailes.invalid.org.invalid> - 2016-12-19 13:42 +0100

csiph-web