Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > microsoft.public.scripting.vbscript > #11432 > unrolled thread
| Started by | Chitra Balasubramani <chitrabala274@gmail.com> |
|---|---|
| First post | 2016-11-27 22:57 -0800 |
| Last post | 2016-12-19 13:42 +0100 |
| Articles | 20 on this page of 22 — 6 participants |
Back to article view | Back to microsoft.public.scripting.vbscript
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
Page 1 of 2 [1] 2 Next page →
| From | Chitra Balasubramani <chitrabala274@gmail.com> |
|---|---|
| Date | 2016-11-27 22:57 -0800 |
| Subject | VB Script for creating zip file and copying files into it. |
| Message-ID | <272535d3-23c0-44b7-bcdf-b99ede1fad18@googlegroups.com> |
Hello,
I'm trying to create a zip file and copy files into it via VBS code.
Problem is Files are not getting copied, only zip file is getting created.
Here is my code :
Set fso = CreateObject("Scripting.FileSystemObject")
Set ts = fso.OpenTextFile("C:\apace-jmeter-3\bin\Results\outcome.zip", 2, True)
ts.Write "PK" & Chr(5) & Chr(6) & String( 18, Chr(0) )
Set fso = nothing
Set ts = nothing
WScript.Sleep 5000
Set objShell = CreateObject("Shell.Application")
Set DestFldr=objShell.NameSpace("C:\apace-jmeter-3\bin\Results\outcome.zip")
Set SrcFldr=objShell.NameSpace("C:\Users\chitra.balasubramani\Desktop\Mail")
DestFldr.CopyHere SrcFldr
Thanks in advance.
[toc] | [next] | [standalone]
| From | "R.Wieser" <address@not.available> |
|---|---|
| Date | 2016-11-28 09:24 +0100 |
| Message-ID | <583be929$0$21473$e4fe514c@news.xs4all.nl> |
| In reply to | #11432 |
Chitra,
> Problem is Files are not getting copied, only zip file is getting created.
Try ading a "sleep" after the CopyHere command, and see what happens.
Explanation: When the CopyHere has been requested, but the actual copying
hasn't started yet (it takes a bit of time to gather all the neccesary file
info) the ending of the script closes the ZIP object, not giving it a chance
to actually start the copying (when the process is started the ZIP object
will not close until it has finished copying)
Regards,
Rudy Wieser
-- Origional message:
Chitra Balasubramani <chitrabala274@gmail.com> schreef in berichtnieuws
272535d3-23c0-44b7-bcdf-b99ede1fad18@googlegroups.com...
> Hello,
>
> I'm trying to create a zip file and copy files into it via VBS code.
>
> Problem is Files are not getting copied, only zip file is getting created.
>
> Here is my code :
>
> Set fso = CreateObject("Scripting.FileSystemObject")
> Set ts = fso.OpenTextFile("C:\apace-jmeter-3\bin\Results\outcome.zip", 2,
True)
> ts.Write "PK" & Chr(5) & Chr(6) & String( 18, Chr(0) )
> Set fso = nothing
> Set ts = nothing
>
> WScript.Sleep 5000
>
>
> Set objShell = CreateObject("Shell.Application")
> Set
DestFldr=objShell.NameSpace("C:\apace-jmeter-3\bin\Results\outcome.zip")
> Set
SrcFldr=objShell.NameSpace("C:\Users\chitra.balasubramani\Desktop\Mail")
> DestFldr.CopyHere SrcFldr
>
> Thanks in advance.
[toc] | [prev] | [next] | [standalone]
| From | Chitra Balasubramani <chitrabala274@gmail.com> |
|---|---|
| Date | 2016-11-28 02:25 -0800 |
| Message-ID | <6b6acec6-bf5a-401b-b4de-86713f6d3b95@googlegroups.com> |
| In reply to | #11433 |
On Monday, 28 November 2016 13:52:03 UTC+5:30, R.Wieser wrote:
> Chitra,
>
> > Problem is Files are not getting copied, only zip file is getting created.
>
> Try ading a "sleep" after the CopyHere command, and see what happens.
>
> Explanation: When the CopyHere has been requested, but the actual copying
> hasn't started yet (it takes a bit of time to gather all the neccesary file
> info) the ending of the script closes the ZIP object, not giving it a chance
> to actually start the copying (when the process is started the ZIP object
> will not close until it has finished copying)
>
> Regards,
> Rudy Wieser
>
>
> -- Origional message:
> Chitra Balasubramani <chitrabala274@gmail.com> schreef in berichtnieuws
> 272535d3-23c0-44b7-bcdf-b99ede1fad18@googlegroups.com...
> > Hello,
> >
> > I'm trying to create a zip file and copy files into it via VBS code.
> >
> > Problem is Files are not getting copied, only zip file is getting created.
> >
> > Here is my code :
> >
> > Set fso = CreateObject("Scripting.FileSystemObject")
> > Set ts = fso.OpenTextFile("C:\apace-jmeter-3\bin\Results\outcome.zip", 2,
> True)
> > ts.Write "PK" & Chr(5) & Chr(6) & String( 18, Chr(0) )
> > Set fso = nothing
> > Set ts = nothing
> >
> > WScript.Sleep 5000
> >
> >
> > Set objShell = CreateObject("Shell.Application")
> > Set
> DestFldr=objShell.NameSpace("C:\apace-jmeter-3\bin\Results\outcome.zip")
> > Set
> SrcFldr=objShell.NameSpace("C:\Users\chitra.balasubramani\Desktop\Mail")
> > DestFldr.CopyHere SrcFldr
> >
> > Thanks in advance.
Wieser,
Thanks for the response.
Tried adding sleep. Now getting "Access Denied Error"
ZipFile = "C:\apace-jmeter-3\bin\Results\outcome.zip"
SourceFolder ="C:\Users\chitra.balasubramani\Desktop\Mail"
Set fso = CreateObject("Scripting.FileSystemObject")
Set ts = fso.CreateTextFile(ZipFile, True)
ts.Write "PK" & Chr(5) & Chr(6) & String( 18, Chr(0) )
ts.Close
Set ts = Nothing
Set fso = Nothing
Set zip = CreateObject("Shell.Application").NameSpace(ZipFile)
' Get items in source folder
Set sourceItems = CreateObject("Shell.Application").NameSpace(SourceFolder).Items
' Add all files/directories to the .zip file
zip.CopyHere(sourceItems)
WScript.Sleep 5000 'Wait for items to be copied
Thanks,
Chitra
[toc] | [prev] | [next] | [standalone]
| From | "R.Wieser" <address@not.available> |
|---|---|
| Date | 2016-11-28 11:48 +0100 |
| Message-ID | <583c0ac9$0$21397$e4fe514c@news.xs4all.nl> |
| In reply to | #11434 |
Chitra,
> Tried adding sleep. Now getting "Access Denied Error"
That seems to mean that the CopyHere is actually trying to copy some
file(s). :-)
I get the feeling that you get that error because one of the files in
"C:\Users\chitra.balasubramani\Desktop\Mail" is still in use (is your mail
program still running ? If so, close it before running the script).
Have you tried to just copy those files to a temporary normal folder and see
if you get the same error (using VBScript but also try drag-and-dropping
them using the file/windows explorer) ?
Regards,
Rudy Wieser
-- Origional message:
Chitra Balasubramani <chitrabala274@gmail.com> schreef in berichtnieuws
6b6acec6-bf5a-401b-b4de-86713f6d3b95@googlegroups.com...
> On Monday, 28 November 2016 13:52:03 UTC+5:30, R.Wieser wrote:
> > Chitra,
> >
> > > Problem is Files are not getting copied, only zip file is getting
created.
> >
> > Try ading a "sleep" after the CopyHere command, and see what happens.
> >
> > Explanation: When the CopyHere has been requested, but the actual
copying
> > hasn't started yet (it takes a bit of time to gather all the neccesary
file
> > info) the ending of the script closes the ZIP object, not giving it a
chance
> > to actually start the copying (when the process is started the ZIP
object
> > will not close until it has finished copying)
> >
> > Regards,
> > Rudy Wieser
> >
> >
> > -- Origional message:
> > Chitra Balasubramani <chitrabala274@gmail.com> schreef in berichtnieuws
> > 272535d3-23c0-44b7-bcdf-b99ede1fad18@googlegroups.com...
> > > Hello,
> > >
> > > I'm trying to create a zip file and copy files into it via VBS code.
> > >
> > > Problem is Files are not getting copied, only zip file is getting
created.
> > >
> > > Here is my code :
> > >
> > > Set fso = CreateObject("Scripting.FileSystemObject")
> > > Set ts = fso.OpenTextFile("C:\apace-jmeter-3\bin\Results\outcome.zip",
2,
> > True)
> > > ts.Write "PK" & Chr(5) & Chr(6) & String( 18, Chr(0) )
> > > Set fso = nothing
> > > Set ts = nothing
> > >
> > > WScript.Sleep 5000
> > >
> > >
> > > Set objShell = CreateObject("Shell.Application")
> > > Set
> > DestFldr=objShell.NameSpace("C:\apace-jmeter-3\bin\Results\outcome.zip")
> > > Set
> > SrcFldr=objShell.NameSpace("C:\Users\chitra.balasubramani\Desktop\Mail")
> > > DestFldr.CopyHere SrcFldr
> > >
> > > Thanks in advance.
>
>
>
> Wieser,
>
> Thanks for the response.
>
> Tried adding sleep. Now getting "Access Denied Error"
>
>
> ZipFile = "C:\apace-jmeter-3\bin\Results\outcome.zip"
> SourceFolder ="C:\Users\chitra.balasubramani\Desktop\Mail"
>
> Set fso = CreateObject("Scripting.FileSystemObject")
> Set ts = fso.CreateTextFile(ZipFile, True)
> ts.Write "PK" & Chr(5) & Chr(6) & String( 18, Chr(0) )
> ts.Close
> Set ts = Nothing
> Set fso = Nothing
>
> Set zip = CreateObject("Shell.Application").NameSpace(ZipFile)
>
> ' Get items in source folder
> Set sourceItems =
CreateObject("Shell.Application").NameSpace(SourceFolder).Items
>
> ' Add all files/directories to the .zip file
> zip.CopyHere(sourceItems)
> WScript.Sleep 5000 'Wait for items to be copied
>
> Thanks,
> Chitra
[toc] | [prev] | [next] | [standalone]
| From | Chitra Balasubramani <chitrabala274@gmail.com> |
|---|---|
| Date | 2016-11-28 02:47 -0800 |
| Message-ID | <74a5c05c-e698-4286-ac91-6139c6b27f4e@googlegroups.com> |
| In reply to | #11435 |
On Monday, 28 November 2016 16:15:31 UTC+5:30, R.Wieser wrote:
> Chitra,
>
> > Tried adding sleep. Now getting "Access Denied Error"
>
> That seems to mean that the CopyHere is actually trying to copy some
> file(s). :-)
>
> I get the feeling that you get that error because one of the files in
> "C:\Users\chitra.balasubramani\Desktop\Mail" is still in use (is your mail
> program still running ? If so, close it before running the script).
>
> Have you tried to just copy those files to a temporary normal folder and see
> if you get the same error (using VBScript but also try drag-and-dropping
> them using the file/windows explorer) ?
>
> Regards,
> Rudy Wieser
>
>
> -- Origional message:
> Chitra Balasubramani <chitrabala274@gmail.com> schreef in berichtnieuws
> 6b6acec6-bf5a-401b-b4de-86713f6d3b95@googlegroups.com...
> > On Monday, 28 November 2016 13:52:03 UTC+5:30, R.Wieser wrote:
> > > Chitra,
> > >
> > > > Problem is Files are not getting copied, only zip file is getting
> created.
> > >
> > > Try ading a "sleep" after the CopyHere command, and see what happens.
> > >
> > > Explanation: When the CopyHere has been requested, but the actual
> copying
> > > hasn't started yet (it takes a bit of time to gather all the neccesary
> file
> > > info) the ending of the script closes the ZIP object, not giving it a
> chance
> > > to actually start the copying (when the process is started the ZIP
> object
> > > will not close until it has finished copying)
> > >
> > > Regards,
> > > Rudy Wieser
> > >
> > >
> > > -- Origional message:
> > > Chitra Balasubramani <chitrabala274@gmail.com> schreef in berichtnieuws
> > > 272535d3-23c0-44b7-bcdf-b99ede1fad18@googlegroups.com...
> > > > Hello,
> > > >
> > > > I'm trying to create a zip file and copy files into it via VBS code.
> > > >
> > > > Problem is Files are not getting copied, only zip file is getting
> created.
> > > >
> > > > Here is my code :
> > > >
> > > > Set fso = CreateObject("Scripting.FileSystemObject")
> > > > Set ts = fso.OpenTextFile("C:\apace-jmeter-3\bin\Results\outcome.zip",
> 2,
> > > True)
> > > > ts.Write "PK" & Chr(5) & Chr(6) & String( 18, Chr(0) )
> > > > Set fso = nothing
> > > > Set ts = nothing
> > > >
> > > > WScript.Sleep 5000
> > > >
> > > >
> > > > Set objShell = CreateObject("Shell.Application")
> > > > Set
> > > DestFldr=objShell.NameSpace("C:\apace-jmeter-3\bin\Results\outcome.zip")
> > > > Set
> > > SrcFldr=objShell.NameSpace("C:\Users\chitra.balasubramani\Desktop\Mail")
> > > > DestFldr.CopyHere SrcFldr
> > > >
> > > > Thanks in advance.
> >
> >
> >
> > Wieser,
> >
> > Thanks for the response.
> >
> > Tried adding sleep. Now getting "Access Denied Error"
> >
> >
> > ZipFile = "C:\apace-jmeter-3\bin\Results\outcome.zip"
> > SourceFolder ="C:\Users\chitra.balasubramani\Desktop\Mail"
> >
> > Set fso = CreateObject("Scripting.FileSystemObject")
> > Set ts = fso.CreateTextFile(ZipFile, True)
> > ts.Write "PK" & Chr(5) & Chr(6) & String( 18, Chr(0) )
> > ts.Close
> > Set ts = Nothing
> > Set fso = Nothing
> >
> > Set zip = CreateObject("Shell.Application").NameSpace(ZipFile)
> >
> > ' Get items in source folder
> > Set sourceItems =
> CreateObject("Shell.Application").NameSpace(SourceFolder).Items
> >
> > ' Add all files/directories to the .zip file
> > zip.CopyHere(sourceItems)
> > WScript.Sleep 5000 'Wait for items to be copied
> >
> > Thanks,
> > Chitra
I tired copying to normal folder, instead of zip. That worked fine.
[toc] | [prev] | [next] | [standalone]
| From | "R.Wieser" <address@not.available> |
|---|---|
| Date | 2016-11-28 12:21 +0100 |
| Message-ID | <583c1289$0$21413$e4fe514c@news.xs4all.nl> |
| In reply to | #11436 |
Chitra, > I 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 folder) If that does not work you could choose to first copy the needed files to a temporay folder (which you could create and remove in the script itself), and 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. :-) Regards, Rudy Wieser -- Origional message: Chitra Balasubramani <chitrabala274@gmail.com> schreef in berichtnieuws 74a5c05c-e698-4286-ac91-6139c6b27f4e@googlegroups.com... > On Monday, 28 November 2016 16:15:31 UTC+5:30, R.Wieser wrote: > > Chitra, > > > > > Tried adding sleep. Now getting "Access Denied Error" > > > > That seems to mean that the CopyHere is actually trying to copy some > > file(s). :-) > > > > I get the feeling that you get that error because one of the files in > > "C:\Users\chitra.balasubramani\Desktop\Mail" is still in use (is your mail > > program still running ? If so, close it before running the script). > > > > Have you tried to just copy those files to a temporary normal folder and see > > if you get the same error (using VBScript but also try drag-and-dropping > > them using the file/windows explorer) ? > > > > Regards, > > Rudy Wieser > > ... > > I tired copying to normal folder, instead of zip. That worked fine.
[toc] | [prev] | [next] | [standalone]
| From | Chitra Balasubramani <chitrabala274@gmail.com> |
|---|---|
| Date | 2016-11-28 04:07 -0800 |
| Message-ID | <0bf6b357-ef5d-4242-992d-bca114e4810a@googlegroups.com> |
| In reply to | #11437 |
On Monday, 28 November 2016 16:49:06 UTC+5:30, R.Wieser wrote:
> Chitra,
>
> > I 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
> folder)
>
> If that does not work you could choose to first copy the needed files to a
> temporay folder (which you could create and remove in the script itself),
> and 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. :-)
>
> Regards,
> Rudy Wieser
>
>
> -- Origional message:
> Chitra Balasubramani <chitrabala274@gmail.com> schreef in berichtnieuws
> 74a5c05c-e698-4286-ac91-6139c6b27f4e@googlegroups.com...
> > On Monday, 28 November 2016 16:15:31 UTC+5:30, R.Wieser wrote:
> > > Chitra,
> > >
> > > > Tried adding sleep. Now getting "Access Denied Error"
> > >
> > > That seems to mean that the CopyHere is actually trying to copy some
> > > file(s). :-)
> > >
> > > I get the feeling that you get that error because one of the files in
> > > "C:\Users\chitra.balasubramani\Desktop\Mail" is still in use (is your
> mail
> > > program still running ? If so, close it before running the script).
> > >
> > > Have you tried to just copy those files to a temporary normal folder and
> see
> > > if you get the same error (using VBScript but also try drag-and-dropping
> > > them using the file/windows explorer) ?
> > >
> > > Regards,
> > > Rudy Wieser
> > >
> ...
> >
> > I tired copying to normal folder, instead of zip. That worked fine.
Wieser,
If 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.
Changed copyHere as "DestFldr.CopyHere (SrcFldr.Items)"
Thanks,
CHitra
[toc] | [prev] | [next] | [standalone]
| From | "R.Wieser" <address@not.available> |
|---|---|
| Date | 2016-11-28 17:04 +0100 |
| Message-ID | <583c54ef$0$21511$e4fe514c@news.xs4all.nl> |
| In reply to | #11438 |
Chitra (is that your first name ? I'm not sure),
> If 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)
Your code create the empty ZIP file like this:
ts.Write "PK" & Chr(5) & Chr(6) & String( 18, Chr(0) )
could you try it like this:
ts.Write chr(80) & chr(75) & Chr(5) & Chr(6) & String( 18, 0)
Regards,
Rudy Wieser
-- Origional message:
Chitra Balasubramani <chitrabala274@gmail.com> schreef in berichtnieuws
0bf6b357-ef5d-4242-992d-bca114e4810a@googlegroups.com...
> On Monday, 28 November 2016 16:49:06 UTC+5:30, R.Wieser wrote:
> > Chitra,
> >
> > > I 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
> > folder)
> >
> > If that does not work you could choose to first copy the needed files to
a
> > temporay folder (which you could create and remove in the script
itself),
> > and 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.
:-)
> >
> > Regards,
> > Rudy Wieser
> >
> >
...
>
> Wieser,
>
> If 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.
>
> Changed copyHere as "DestFldr.CopyHere (SrcFldr.Items)"
>
> Thanks,
> CHitra
[toc] | [prev] | [next] | [standalone]
| From | Chitra Balasubramani <chitrabala274@gmail.com> |
|---|---|
| Date | 2016-11-28 20:06 -0800 |
| Message-ID | <fa9fa6c3-3da5-433a-8fdb-77497f96c443@googlegroups.com> |
| In reply to | #11440 |
On Monday, 28 November 2016 21:32:13 UTC+5:30, R.Wieser wrote:
> Chitra (is that your first name ? I'm not sure),
>
> > If 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)
>
> Your code create the empty ZIP file like this:
>
> ts.Write "PK" & Chr(5) & Chr(6) & String( 18, Chr(0) )
>
> could you try it like this:
>
> ts.Write chr(80) & chr(75) & Chr(5) & Chr(6) & String( 18, 0)
>
> Regards,
> Rudy Wieser
>
>
> -- Origional message:
> Chitra Balasubramani <chitrabala274@gmail.com> schreef in berichtnieuws
> 0bf6b357-ef5d-4242-992d-bca114e4810a@googlegroups.com...
> > On Monday, 28 November 2016 16:49:06 UTC+5:30, R.Wieser wrote:
> > > Chitra,
> > >
> > > > I 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
> > > folder)
> > >
> > > If that does not work you could choose to first copy the needed files to
> a
> > > temporay folder (which you could create and remove in the script
> itself),
> > > and 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.
> :-)
> > >
> > > Regards,
> > > Rudy Wieser
> > >
> > >
> ...
> >
> > Wieser,
> >
> > If 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.
> >
> > Changed copyHere as "DestFldr.CopyHere (SrcFldr.Items)"
> >
> > Thanks,
> > CHitra
Yes Chitra is my first name :)
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.
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.
[toc] | [prev] | [next] | [standalone]
| From | "Evertjan." <exxjxw.hannivoort@inter.nl.net> |
|---|---|
| Date | 2016-11-29 08:16 +0100 |
| Message-ID | <XnsA6CF5418C4A39eejj99@194.109.6.166> |
| In reply to | #11442 |
Chitra Balasubramani <chitrabala274@gmail.com> wrote on 29 Nov 2016 in microsoft.public.scripting.vbscript: > 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. I would think you cannot "copy" a file to a zip-file, as it involves compression not available to the basic operating system, and a zip-dile is not [just] a folder/directory. Is this only a Q of semantics? Your ordeal suggests otherwise. -- Evertjan. The Netherlands. (Please change the x'es to dots in my emailaddress)
[toc] | [prev] | [next] | [standalone]
| From | Chitra Balasubramani <chitrabala274@gmail.com> |
|---|---|
| Date | 2016-11-29 02:36 -0800 |
| Message-ID | <09938346-5706-4950-88b0-35b85271029e@googlegroups.com> |
| In reply to | #11443 |
On Tuesday, 29 November 2016 12:45:58 UTC+5:30, Evertjan. wrote: > Chitra Balasubramani <chitrabala274@gmail.com> wrote on 29 Nov 2016 in > microsoft.public.scripting.vbscript: > > > 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. > > I would think you cannot "copy" a file to a zip-file, > as it involves compression not available to the basic operating system, > and a zip-dile is not [just] a folder/directory. > Yes that's what happening. Able to copy to normal folder not zip files. > Is this only a Q of semantics? > > Your ordeal suggests otherwise. > > -- > Evertjan. > The Netherlands. > (Please change the x'es to dots in my emailaddress)
[toc] | [prev] | [next] | [standalone]
| From | "R.Wieser" <address@not.available> |
|---|---|
| Date | 2016-11-29 08:28 +0100 |
| Message-ID | <583d2d63$0$21404$e4fe514c@news.xs4all.nl> |
| In reply to | #11442 |
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
-- Origoional message:
Chitra Balasubramani <chitrabala274@gmail.com> schreef in berichtnieuws
fa9fa6c3-3da5-433a-8fdb-77497f96c443@googlegroups.com...
> On Monday, 28 November 2016 21:32:13 UTC+5:30, R.Wieser wrote:
> > Chitra (is that your first name ? I'm not sure),
> >
> > > If 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)
> >
> > Your code create the empty ZIP file like this:
> >
> > ts.Write "PK" & Chr(5) & Chr(6) & String( 18, Chr(0) )
> >
> > could you try it like this:
> >
> > ts.Write chr(80) & chr(75) & Chr(5) & Chr(6) & String( 18, 0)
> >
> > Regards,
> > Rudy Wieser
> >
> >
> > -- Origional message:
> > Chitra Balasubramani <chitrabala274@gmail.com> schreef in berichtnieuws
> > 0bf6b357-ef5d-4242-992d-bca114e4810a@googlegroups.com...
> > > On Monday, 28 November 2016 16:49:06 UTC+5:30, R.Wieser wrote:
> > > > Chitra,
> > > >
> > > > > I 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
> > > > folder)
> > > >
> > > > If that does not work you could choose to first copy the needed
files to
> > a
> > > > temporay folder (which you could create and remove in the script
> > itself),
> > > > and 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.
> > :-)
> > > >
> > > > Regards,
> > > > Rudy Wieser
> > > >
> > > >
> > ...
> > >
> > > Wieser,
> > >
> > > If 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.
> > >
> > > Changed copyHere as "DestFldr.CopyHere (SrcFldr.Items)"
> > >
> > > Thanks,
> > > CHitra
>
>
>
> Yes Chitra is my first name :)
>
> 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.
>
> 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.
>
>
[toc] | [prev] | [next] | [standalone]
| From | "Evertjan." <exxjxw.hannivoort@inter.nl.net> |
|---|---|
| Date | 2016-11-29 08:47 +0100 |
| Message-ID | <XnsA6CF5961DB07Ceejj99@194.109.6.166> |
| In reply to | #11444 |
"R.Wieser" <address@not.available> wrote on 29 Nov 2016 in microsoft.public.scripting.vbscript: > :-) 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. "Sir Rudy"? -- Evertjan. The Netherlands. (Please change the x'es to dots in my emailaddress)
[toc] | [prev] | [next] | [standalone]
| From | "R.Wieser" <address@not.available> |
|---|---|
| Date | 2016-11-29 08:59 +0100 |
| Message-ID | <583d34ae$0$21446$e4fe514c@news.xs4all.nl> |
| In reply to | #11445 |
Evertjan, > "Sir Rudy"? Finally, someone who acknowledges my grandness ! :-D No, Chitra started his messages by adressing me by just my last name (no "mr" prefix or alike). Which made me wonder if I was maybe (mistakingly!) doing the same (adressing him by just his last name) because of a possible different ordering of (what westerlings call) the first and last/sirname. Regards, Rudy Wieser -- Origional message: Evertjan. <exxjxw.hannivoort@inter.nl.net> schreef in berichtnieuws XnsA6CF5961DB07Ceejj99@194.109.6.166... > "R.Wieser" <address@not.available> wrote on 29 Nov 2016 in > microsoft.public.scripting.vbscript: > > > :-) 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. > > "Sir Rudy"? > > -- > Evertjan. > The Netherlands. > (Please change the x'es to dots in my emailaddress)
[toc] | [prev] | [next] | [standalone]
| From | Chitra Balasubramani <chitrabala274@gmail.com> |
|---|---|
| Date | 2016-11-29 01:37 -0800 |
| Message-ID | <c7544106-b88c-4e7b-baeb-ad52c0407bc9@googlegroups.com> |
| In reply to | #11444 |
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
>
>
> -- Origoional message:
> Chitra Balasubramani <chitrabala274@gmail.com> schreef in berichtnieuws
> fa9fa6c3-3da5-433a-8fdb-77497f96c443@googlegroups.com...
> > On Monday, 28 November 2016 21:32:13 UTC+5:30, R.Wieser wrote:
> > > Chitra (is that your first name ? I'm not sure),
> > >
> > > > If 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)
> > >
> > > Your code create the empty ZIP file like this:
> > >
> > > ts.Write "PK" & Chr(5) & Chr(6) & String( 18, Chr(0) )
> > >
> > > could you try it like this:
> > >
> > > ts.Write chr(80) & chr(75) & Chr(5) & Chr(6) & String( 18, 0)
> > >
> > > Regards,
> > > Rudy Wieser
> > >
> > >
> > > -- Origional message:
> > > Chitra Balasubramani <chitrabala274@gmail.com> schreef in berichtnieuws
> > > 0bf6b357-ef5d-4242-992d-bca114e4810a@googlegroups.com...
> > > > On Monday, 28 November 2016 16:49:06 UTC+5:30, R.Wieser wrote:
> > > > > Chitra,
> > > > >
> > > > > > I 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
> > > > > folder)
> > > > >
> > > > > If that does not work you could choose to first copy the needed
> files to
> > > a
> > > > > temporay folder (which you could create and remove in the script
> > > itself),
> > > > > and 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.
> > > :-)
> > > > >
> > > > > Regards,
> > > > > Rudy Wieser
> > > > >
> > > > >
> > > ...
> > > >
> > > > Wieser,
> > > >
> > > > If 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.
> > > >
> > > > Changed copyHere as "DestFldr.CopyHere (SrcFldr.Items)"
> > > >
> > > > Thanks,
> > > > CHitra
> >
> >
> >
> > Yes Chitra is my first name :)
> >
> > 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.
> >
> > 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.
> >
> >
Rudy,
Yes the problem is "CopyHere" failing for the empty zip created manually.
Thanks,
Chitra
[toc] | [prev] | [next] | [standalone]
| From | "R.Wieser" <address@not.available> |
|---|---|
| Date | 2016-11-29 11:58 +0100 |
| Message-ID | <583d5eb3$0$21399$e4fe514c@news.xs4all.nl> |
| In reply to | #11447 |
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
[toc] | [prev] | [next] | [standalone]
| From | Chitra Balasubramani <chitrabala274@gmail.com> |
|---|---|
| Date | 2016-11-29 19:49 -0800 |
| Message-ID | <8342c826-ae94-40d9-90ba-e1f24f311ebf@googlegroups.com> |
| In reply to | #11449 |
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
[toc] | [prev] | [next] | [standalone]
| From | "R.Wieser" <address@not.available> |
|---|---|
| Date | 2016-11-30 08:53 +0100 |
| Message-ID | <583e84cf$0$21485$e4fe514c@news.xs4all.nl> |
| In reply to | #11461 |
Chitra,
> I tried the below code as well.
[snip]
I'm sorry, but I'm really outof ideas to try. And as I can't reproduce the
problem here, there is little I can do to find out why its not working at
your side.
I hope someone else has some insight to what the problem might be.
Regards,
Rudy Wieser
-- Origional message:
Chitra Balasubramani <chitrabala274@gmail.com> schreef in berichtnieuws
8342c826-ae94-40d9-90ba-e1f24f311ebf@googlegroups.com...
>
> 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
[toc] | [prev] | [next] | [standalone]
| From | Ulrich Möller <knobbi38@arcor.de> |
|---|---|
| Date | 2016-11-30 13:53 +0100 |
| Message-ID | <o1mhvm$vc5$1@dont-email.me> |
| In reply to | #11461 |
Am 30.11.2016 um 04:49 schrieb Chitra Balasubramani:
> 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
Hi,
may be you do have some access errors! Check each component of the
destination and source path if you have the correct rights (including
the newly created zipfile!) with the window command cacls or icalcs.
Here are some links:
http://www.robvanderwoude.com/vbstech_files_zip.php
http://www.xstandard.com/en/documentation/xzip/
Ulrich
[toc] | [prev] | [next] | [standalone]
| From | "Dave \"Crash\" Dummy" <invalid@invalid.invalid> |
|---|---|
| Date | 2016-11-29 11:56 -0500 |
| Message-ID | <o1kbst$943$1@dont-email.me> |
| In reply to | #11432 |
Chitra Balasubramani wrote:
> Hello,
>
> I'm trying to create a zip file and copy files into it via VBS code.
>
>
> Problem is Files are not getting copied, only zip file is getting
> created.
>
> Here is my code :
>
> Set fso = CreateObject("Scripting.FileSystemObject") Set ts =
> fso.OpenTextFile("C:\apace-jmeter-3\bin\Results\outcome.zip", 2,
> True) ts.Write "PK" & Chr(5) & Chr(6) & String( 18, Chr(0) ) Set fso
> = nothing Set ts = nothing
>
> WScript.Sleep 5000
>
> Set objShell = CreateObject("Shell.Application") Set
> DestFldr=objShell.NameSpace("C:\apace-jmeter-3\bin\Results\outcome.zip")
> Set
> SrcFldr=objShell.NameSpace("C:\Users\chitra.balasubramani\Desktop\Mail")
> DestFldr.CopyHere SrcFldr
>
> Thanks in advance.
I cheat. Instead of trying to use a script created zip file, I use the
freeware 7-Zip utility. Life is so much easier.
Set WshShell = CreateObject("WScript.Shell")
cmd="D:\path\7z.exe a"
DestFldr=" C:\apace-jmeter-3\bin\Results\outcome.zip"
SrcFldr=" C:\Users\chitra.balasubramani\Desktop\Mail\*.*"
ret=WshShell.Run(cmd & DestFldr & SrcFldr,0,true)
--
Crash
"Never underestimate the power of the Dark Side."
~ Obi-Wan Kenobi ~
[toc] | [prev] | [next] | [standalone]
Page 1 of 2 [1] 2 Next page →
Back to top | Article view | microsoft.public.scripting.vbscript
csiph-web