Chitra,
Post by Chitra BalasubramaniYes 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.
Post by Chitra Balasubramani1. 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.
Post by Chitra BalasubramaniAnd 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
Post by Chitra BalasubramaniPost by R.WieserChitra (is that your first name ? I'm not sure),
Post by Chitra BalasubramaniIf the dest folder is "Set DestFldr=objShell.NameSpace(
"C:\apace-jmeter-3\bin\Results\Temp")", Copy is working.
If the dest is Set DestFldr=objShell.NameSpace(
"C:\apace-jmeter-3\bin\Results\outcome.zip")", getting access
denied error.
Hmmm ... I assumed the sourcefile(s) could be unreadable (because some
other program still has (one of) them open, but its possible that the target
file (the .ZIP) is the actual culprit here.
Have you already tried to open the created (but presumably empty) .ZIP file
? Can you ? If so, whats inside (folders, files)
ts.Write "PK" & Chr(5) & Chr(6) & String( 18, Chr(0) )
ts.Write chr(80) & chr(75) & Chr(5) & Chr(6) & String( 18, 0)
Regards,
Rudy Wieser
Post by Chitra BalasubramaniPost by R.WieserChitra,
Post by Chitra BalasubramaniI tired copying to normal folder, instead of zip. That worked fine.
Hmmm ...
There is one more thing you can try: Try changing
zip.CopyHere(sourceItems)
to
zip.CopyHere(sourceItems.items)
(the former will copy the foldername too, the latter only the files in
that
Post by Chitra BalasubramaniPost by R.Wieserfolder)
If that does not work you could choose to first copy the needed files to
a
Post by Chitra BalasubramaniPost by R.Wiesertemporay folder (which you could create and remove in the script
itself),
Post by Chitra BalasubramaniPost by R.Wieserand from there copy them into the ZIP file. Yes, I know that that is a
work-around, but if the direct way fails you need to come up with a fix.
:-)
...
Post by Chitra BalasubramaniWieser,
If the dest folder is "Set
DestFldr=objShell.NameSpace("C:\apace-jmeter-3\bin\Results\Temp")", Copy is
working.
DestFldr=objShell.NameSpace("C:\apace-jmeter-3\bin\Results\outcome.zip")",
Post by Chitra BalasubramaniPost by R.Wiesergetting access denied error.
Post by Chitra BalasubramaniChanged copyHere as "DestFldr.CopyHere (SrcFldr.Items)"
Thanks,
CHitra
Yes Chitra is my first name :)
1. Copying those files to folder instead of zip. - Worked
2. Copying files to empty zip which was created manually - Access Denied error.
So the problem is VBS is not able to copy files to any of the zip files.
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.