X-Received: by 10.99.253.69 with SMTP id m5mr14664540pgj.28.1480477786184; Tue, 29 Nov 2016 19:49:46 -0800 (PST) X-Received: by 10.157.11.120 with SMTP id p53mr1472304otd.19.1480477786116; Tue, 29 Nov 2016 19:49:46 -0800 (PST) Path: csiph.com!feeder.erje.net!1.us.feeder.erje.net!newspeer1.nac.net!border2.nntp.dca1.giganews.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!n6no95725qtd.0!news-out.google.com!j8ni470qtc.0!nntp.google.com!p16no94539qta.1!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: microsoft.public.scripting.vbscript Date: Tue, 29 Nov 2016 19:49:44 -0800 (PST) In-Reply-To: <583d5eb3$0$21399$e4fe514c@news.xs4all.nl> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=61.12.35.115; posting-account=DEHywwoAAABxlArdHf7lIL0PyWSk9dOv NNTP-Posting-Host: 61.12.35.115 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> <583d2d63$0$21404$e4fe514c@news.xs4all.nl> <583d5eb3$0$21399$e4fe514c@news.xs4all.nl> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <8342c826-ae94-40d9-90ba-e1f24f311ebf@googlegroups.com> Subject: Re: VB Script for creating zip file and copying files into it. From: Chitra Balasubramani Injection-Date: Wed, 30 Nov 2016 03:49:46 +0000 Content-Type: text/plain; charset=UTF-8 Lines: 120 Xref: csiph.com microsoft.public.scripting.vbscript:11461 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 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