Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

compress (zipped) folders issue

2,227 views
Skip to first unread message

RdS

unread,
Dec 3, 2007, 8:54:00 PM12/3/07
to
hi,

I am performing the following which works perfectly if there is not an empty
subdirectory within the folder I am trying to zip.


src = "c:\temp\"
dest = "c:\test\test1.zip"

'write zip file header
set fso = createobject("Scripting.FileSystemObject")
set file = fso.opentextfile(dest,forwriting,true)
file.write "PK" & chr(5) & chr(6) & string(18,chr(0))
file.close

set shl = createobject("Shell.Applicatioin")
shl.namespace(dest).copyhere shl.namespace(src).items
do until shl.namespace(dest).items.count = shl.namespace(src).items.count
wscript.sleep 100
loop

However, if there is an empty subdirectory I receive the following error
"The specified directory c:\temp\vbe is empty, so compressed (zipped) folders
cannot add it to the archive.

How do I prevent this from happening. If I do the same thing manually by
right clicking on temp and choosing send to\compressed folder I do not
receive the error.

thanks.

WenYuan Wang [MSFT]

unread,
Dec 4, 2007, 6:48:41 AM12/4/07
to
Hello RdS,

I understood your issue is that VBScript throw an error when tring to
insert an empty subdirectory into compress(zip) folder. If I misunderstood
anything here, please feel free to correct me.

If this is the case, I have reproduced it on my side.
We need to perform more research on this issue . We will reply here as soon
as possible. If you have any more concerns on it, please feel free to post
here.

Thanks for your understanding!
Best regards,

Wen Yuan
Microsoft Online Community Support
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

WenYuan Wang [MSFT]

unread,
Dec 5, 2007, 4:30:42 AM12/5/07
to
Hello Rds,
Thanks for your waiting.

This error will be thrown when we drop an Empty Directory into Compress
(zipped) folders. You can try it in Windows Explorer.
"Send to compressed folder" does not copy items into Target Compress folder
directly. It warps them in a folder. Thereby, we didn't received error when
compress a folder with an empty subdirectory.

Try the following method can resolve this issue.
set shl = CreateObject("Shell.Application")
shl.namespace(dest).copyhere shl.namespace(src).self
do until shl.namespace(dest).items.count = 1
wscript.sleep 100
loop

Hope this helps, please feel free to update here again, if there is
anything unclear. We are glad to assist you.

Have a great day,

RdS

unread,
Dec 5, 2007, 6:28:00 PM12/5/07
to
Thanks a lot. Is there any way to use compressed (zipped) folders from FSO
as it is very reliable.

have read lots about shell not being so dependable.

Also, I have tried using the options specified in the copyhere docs on MSDN
and have had no success. I don't want progress windows or windows to be
displayed if there is an issue. I want to trap them. :)

thanks again.

WenYuan Wang [MSFT]

unread,
Dec 7, 2007, 2:49:09 AM12/7/07
to
Hello Rds,
Thanks for your reply.

I consulted shell team. Windows XP or above handles Zip files by
zipfldr.dll (which is located in %windir%\system32\zipfldr.dll). It's a
thrid party product. I'm sorry to say Microsoft doesn't provide any API to
compress Zip via zipfldr.dll.

The MSDN documentation you referenced about CopyHere method only applies to
normal file system path.It doesn't work for a zip file folder. That's why
you find the option 4 to disable the progress dialog doesn't help.It's by
desgin.

By the way, currently the zip file functionality is only meant to be used
with User Interaction. In other words, programmatically access to the zip
file NSE is not officially supported.

Hope this helps.

neoge...@gmail.com

unread,
Mar 15, 2013, 10:21:00 AM3/15/13
to
hi, i myself am looking for a code, but i want to zip multiple files into a zip, for example, zip all files thats named "anything" in this folder, using winrar, can anybody help

R.Wieser

unread,
Mar 16, 2013, 6:46:57 AM3/16/13
to
Hey neogenics, I think you can use this:

http://www.techcoil.com/blog/handy-vbscript-functions-for-dealing-with-zip-f
iles-and-folders/

-- Origional message:
<neoge...@gmail.com> schreef in berichtnieuws
a5b46f8a-87a0-47d9...@googlegroups.com...
0 new messages