Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - Re: Compress Folder to a single file?

Reply
 
Old 05-19-2008   #1 (permalink)
Bob H


 
 

Re: Compress Folder to a single file?

Pegasus -
you had me for a second... I was sitting there wondering what went wrong
and realized the first problem. Let me explain... I normally do this from
the send-to menu. So, right click your C:\Test folder and scroll to the
'Send To' menu and then select 'Compressed (zipped) folder'. That is the
direct execution of the compress verb. That will generate a zipped folder..
but, if you have one of the zip variants installed you may not be able to
see the Send To option that I am talking about. Again, I have to admit
you had me stumped for a second. I used to believe the two methods were
identical... I'll have to think about that one a bit.

Happy compressing...
BH

"Pegasus (MVP)" <I.can@xxxxxx> wrote in message
news:eLOYMWPuIHA.4492@xxxxxx
Quote:

>
> "Bob H" <BobH@xxxxxx> wrote in message
> news:ed1CYfOuIHA.1872@xxxxxx
Quote:

>> Two points -
>> 1 - (Pegasus) last time I looked, compressing a folder in XP (at
>> least) resulted in a zip archive. Windows attempts to hide that (or make
>> it invisible to the user), but if you look closer you should find the
>> same result on your system. I have used this fact on numerous
>> occasions.... also the question was not how to zip - though it almost
>> sounds that way at first. All he wanted to do was schedule the code he
>> has.
>
> Thanks for your feedback. To verify your claim, I tried this
> little experiment:
> - Create a folder c:\Test.
> - Populate it with a few files.
> - Launch "My Computer".
> - Right-click c:\Test, then click Properties, then Advanced.
> - Tick "Compress contents to save disk space", then OK, then Apply.
>
> The files in this folder are now compressed but there is no .zip file
> in sight. Each files is individually visible. The native WinXP compression
> method does not use the well-known zip-based compression
> facility but its own algorithm that stores each file in a compressed
> form.
>
> The "Compress" method used by the OP does the same thing,
> hence there is no .zip file.
>
> If you can generate a .zip file with the VB Script "Compress"
> method then I'd love to see your code.
>
>

My System SpecsSystem Spec
Old 05-20-2008   #2 (permalink)
Al Dunbar


 
 

Re: Compress Folder to a single file?

The way I do it is to right-click on a folder, select New..., and select
"Compressed (zipped) folder". Behaves like a folder in windows explorer, but
is actually a .zip file.

/Al

"Bob H" <BobH@xxxxxx> wrote in message
news:e3QqZDhuIHA.3564@xxxxxx
Quote:

> Pegasus -
> you had me for a second... I was sitting there wondering what went
> wrong and realized the first problem. Let me explain... I normally do
> this from the send-to menu. So, right click your C:\Test folder and
> scroll to the 'Send To' menu and then select 'Compressed (zipped) folder'.
> That is the direct execution of the compress verb. That will generate a
> zipped folder.. but, if you have one of the zip variants installed you may
> not be able to see the Send To option that I am talking about. Again, I
> have to admit you had me stumped for a second. I used to believe the two
> methods were identical... I'll have to think about that one a bit.
>
> Happy compressing...
> BH
>
> "Pegasus (MVP)" <I.can@xxxxxx> wrote in message
> news:eLOYMWPuIHA.4492@xxxxxx
Quote:

>>
>> "Bob H" <BobH@xxxxxx> wrote in message
>> news:ed1CYfOuIHA.1872@xxxxxx
Quote:

>>> Two points -
>>> 1 - (Pegasus) last time I looked, compressing a folder in XP (at
>>> least) resulted in a zip archive. Windows attempts to hide that (or
>>> make it invisible to the user), but if you look closer you should find
>>> the same result on your system. I have used this fact on numerous
>>> occasions.... also the question was not how to zip - though it almost
>>> sounds that way at first. All he wanted to do was schedule the code he
>>> has.
>>
>> Thanks for your feedback. To verify your claim, I tried this
>> little experiment:
>> - Create a folder c:\Test.
>> - Populate it with a few files.
>> - Launch "My Computer".
>> - Right-click c:\Test, then click Properties, then Advanced.
>> - Tick "Compress contents to save disk space", then OK, then Apply.
>>
>> The files in this folder are now compressed but there is no .zip file
>> in sight. Each files is individually visible. The native WinXP
>> compression
>> method does not use the well-known zip-based compression
>> facility but its own algorithm that stores each file in a compressed
>> form.
>>
>> The "Compress" method used by the OP does the same thing,
>> hence there is no .zip file.
>>
>> If you can generate a .zip file with the VB Script "Compress"
>> method then I'd love to see your code.
>>
>>

My System SpecsSystem Spec
Old 06-19-2008   #3 (permalink)
Doug


 
 

Re: Compress Folder to a single file?

I also need to compress a folder to a file (.zip) on Windows. One shoul be
able to do it with winzip (similar to old pkzip, or compress on UNIX) from
command prompt (need a winzip modual download). A better way would be to use
net send command to do the same thing with "Send to compressed (zipped)
Folder" from command prompt. However, I do not know the syntax. If any one
knows, please share.

Thanks, Doug

"Bob H" wrote:
Quote:

> Pegasus -
> you had me for a second... I was sitting there wondering what went wrong
> and realized the first problem. Let me explain... I normally do this from
> the send-to menu. So, right click your C:\Test folder and scroll to the
> 'Send To' menu and then select 'Compressed (zipped) folder'. That is the
> direct execution of the compress verb. That will generate a zipped folder..
> but, if you have one of the zip variants installed you may not be able to
> see the Send To option that I am talking about. Again, I have to admit
> you had me stumped for a second. I used to believe the two methods were
> identical... I'll have to think about that one a bit.
>
> Happy compressing...
> BH
>
> "Pegasus (MVP)" <I.can@xxxxxx> wrote in message
> news:eLOYMWPuIHA.4492@xxxxxx
Quote:

> >
> > "Bob H" <BobH@xxxxxx> wrote in message
> > news:ed1CYfOuIHA.1872@xxxxxx
Quote:

> >> Two points -
> >> 1 - (Pegasus) last time I looked, compressing a folder in XP (at
> >> least) resulted in a zip archive. Windows attempts to hide that (or make
> >> it invisible to the user), but if you look closer you should find the
> >> same result on your system. I have used this fact on numerous
> >> occasions.... also the question was not how to zip - though it almost
> >> sounds that way at first. All he wanted to do was schedule the code he
> >> has.
> >
> > Thanks for your feedback. To verify your claim, I tried this
> > little experiment:
> > - Create a folder c:\Test.
> > - Populate it with a few files.
> > - Launch "My Computer".
> > - Right-click c:\Test, then click Properties, then Advanced.
> > - Tick "Compress contents to save disk space", then OK, then Apply.
> >
> > The files in this folder are now compressed but there is no .zip file
> > in sight. Each files is individually visible. The native WinXP compression
> > method does not use the well-known zip-based compression
> > facility but its own algorithm that stores each file in a compressed
> > form.
> >
> > The "Compress" method used by the OP does the same thing,
> > hence there is no .zip file.
> >
> > If you can generate a .zip file with the VB Script "Compress"
> > method then I'd love to see your code.
> >
> >
>
My System SpecsSystem Spec
Old 06-19-2008   #4 (permalink)
Pegasus \(MVP\)


 
 

Re: Compress Folder to a single file?

The purchased version of WinZip has a command line
tool called wzzip.exe that you can use to compress any
number of files to a common .zip file.


"Doug" <Doug@xxxxxx> wrote in message
news:430E2B81-6B43-4AE3-BF9D-0D4AC78E91D6@xxxxxx
Quote:

>I also need to compress a folder to a file (.zip) on Windows. One shoul be
> able to do it with winzip (similar to old pkzip, or compress on UNIX) from
> command prompt (need a winzip modual download). A better way would be to
> use
> net send command to do the same thing with "Send to compressed (zipped)
> Folder" from command prompt. However, I do not know the syntax. If any
> one
> knows, please share.
>
> Thanks, Doug
>
> "Bob H" wrote:
>
Quote:

>> Pegasus -
>> you had me for a second... I was sitting there wondering what went
>> wrong
>> and realized the first problem. Let me explain... I normally do this
>> from
>> the send-to menu. So, right click your C:\Test folder and scroll to the
>> 'Send To' menu and then select 'Compressed (zipped) folder'. That is the
>> direct execution of the compress verb. That will generate a zipped
>> folder..
>> but, if you have one of the zip variants installed you may not be able to
>> see the Send To option that I am talking about. Again, I have to admit
>> you had me stumped for a second. I used to believe the two methods were
>> identical... I'll have to think about that one a bit.
>>
>> Happy compressing...
>> BH
>>
>> "Pegasus (MVP)" <I.can@xxxxxx> wrote in message
>> news:eLOYMWPuIHA.4492@xxxxxx
Quote:

>> >
>> > "Bob H" <BobH@xxxxxx> wrote in message
>> > news:ed1CYfOuIHA.1872@xxxxxx
>> >> Two points -
>> >> 1 - (Pegasus) last time I looked, compressing a folder in XP (at
>> >> least) resulted in a zip archive. Windows attempts to hide that (or
>> >> make
>> >> it invisible to the user), but if you look closer you should find the
>> >> same result on your system. I have used this fact on numerous
>> >> occasions.... also the question was not how to zip - though it almost
>> >> sounds that way at first. All he wanted to do was schedule the code
>> >> he
>> >> has.
>> >
>> > Thanks for your feedback. To verify your claim, I tried this
>> > little experiment:
>> > - Create a folder c:\Test.
>> > - Populate it with a few files.
>> > - Launch "My Computer".
>> > - Right-click c:\Test, then click Properties, then Advanced.
>> > - Tick "Compress contents to save disk space", then OK, then Apply.
>> >
>> > The files in this folder are now compressed but there is no .zip file
>> > in sight. Each files is individually visible. The native WinXP
>> > compression
>> > method does not use the well-known zip-based compression
>> > facility but its own algorithm that stores each file in a compressed
>> > form.
>> >
>> > The "Compress" method used by the OP does the same thing,
>> > hence there is no .zip file.
>> >
>> > If you can generate a .zip file with the VB Script "Compress"
>> > method then I'd love to see your code.
>> >
>> >
>>

My System SpecsSystem Spec
Old 06-19-2008   #5 (permalink)
Tim Williams


 
 

Re: Compress Folder to a single file?

Have you looked at this (XP) ?

http://www.rondebruin.nl/windowsxpzip.htm

Tim



"Doug" <Doug@xxxxxx> wrote in message
news:430E2B81-6B43-4AE3-BF9D-0D4AC78E91D6@xxxxxx
Quote:

>I also need to compress a folder to a file (.zip) on Windows. One shoul be
> able to do it with winzip (similar to old pkzip, or compress on UNIX) from
> command prompt (need a winzip modual download). A better way would be to
> use
> net send command to do the same thing with "Send to compressed (zipped)
> Folder" from command prompt. However, I do not know the syntax. If any
> one
> knows, please share.
>
> Thanks, Doug
>
> "Bob H" wrote:
>
Quote:

>> Pegasus -
>> you had me for a second... I was sitting there wondering what went
>> wrong
>> and realized the first problem. Let me explain... I normally do this
>> from
>> the send-to menu. So, right click your C:\Test folder and scroll to the
>> 'Send To' menu and then select 'Compressed (zipped) folder'. That is the
>> direct execution of the compress verb. That will generate a zipped
>> folder..
>> but, if you have one of the zip variants installed you may not be able to
>> see the Send To option that I am talking about. Again, I have to admit
>> you had me stumped for a second. I used to believe the two methods were
>> identical... I'll have to think about that one a bit.
>>
>> Happy compressing...
>> BH
>>
>> "Pegasus (MVP)" <I.can@xxxxxx> wrote in message
>> news:eLOYMWPuIHA.4492@xxxxxx
Quote:

>> >
>> > "Bob H" <BobH@xxxxxx> wrote in message
>> > news:ed1CYfOuIHA.1872@xxxxxx
>> >> Two points -
>> >> 1 - (Pegasus) last time I looked, compressing a folder in XP (at
>> >> least) resulted in a zip archive. Windows attempts to hide that (or
>> >> make
>> >> it invisible to the user), but if you look closer you should find the
>> >> same result on your system. I have used this fact on numerous
>> >> occasions.... also the question was not how to zip - though it almost
>> >> sounds that way at first. All he wanted to do was schedule the code
>> >> he
>> >> has.
>> >
>> > Thanks for your feedback. To verify your claim, I tried this
>> > little experiment:
>> > - Create a folder c:\Test.
>> > - Populate it with a few files.
>> > - Launch "My Computer".
>> > - Right-click c:\Test, then click Properties, then Advanced.
>> > - Tick "Compress contents to save disk space", then OK, then Apply.
>> >
>> > The files in this folder are now compressed but there is no .zip file
>> > in sight. Each files is individually visible. The native WinXP
>> > compression
>> > method does not use the well-known zip-based compression
>> > facility but its own algorithm that stores each file in a compressed
>> > form.
>> >
>> > The "Compress" method used by the OP does the same thing,
>> > hence there is no .zip file.
>> >
>> > If you can generate a .zip file with the VB Script "Compress"
>> > method then I'd love to see your code.
>> >
>> >
>>

My System SpecsSystem Spec
Old 06-20-2008   #6 (permalink)
Reventlov


 
 

Re: Compress Folder to a single file?

Il giorno Thu, 19 Jun 2008 10:17:01 -0700, =?Utf-8?B?RG91Zw==?=
<Doug@xxxxxx> ha scritto:
Quote:

>I also need to compress a folder to a file (.zip) on Windows. One shoul be
>able to do it with winzip (similar to old pkzip, or compress on UNIX) from
>command prompt (need a winzip modual download). A better way would be to use
>net send command to do the same thing with "Send to compressed (zipped)
>Folder" from command prompt. However, I do not know the syntax. If any one
>knows, please share.
' CreateEmptyZip (nome dello zip da creare)
'
' AddFile2Zip (Nome archivio zip, File da aggiungere)
'
' AddFolder2Zip (Nome archivio zip, Cartella da aggiungere all'archivio)
'
' Creates a zip archive and adds one or more files.
' Uses Win XP native support for zip archives as folders.
'************************************************
ScriptFullName = wscript.scriptfullname
CurrentPath = Left(scriptfullname, InStrRev(ScriptFullName, "\"))

ZipFile = CurrentPath & "test.zip"
FileDaAggiungere = wscript.scriptfullname
FolderDaZippare = CurrentPath & "temp\"

'Crea un file zip vuoto.
a = CreateEmptyZip(ZipFile)
msgbox a 'Deve essere True.

'Aggiunge un file all'archivio zip appena creato.
a = AddFile2Zip (ZipFile, FileDaAggiungere)
msgbox a

'Aggiunge il contenuto di un folder all'archivio zip.
a= AddFolder2Zip (ZipFile, FolderDaZippare)
msgbox a

Function AddFile2Zip (sZipFile, sFile2Add)
'Aggiunge un file all'archivio zip esistente.
'Attenzione: di default il metodo CopyFile sovrascrive.
'NameSpace vuole un pathname completo e non solo il nome file.
On Error Resume Next
AddFile2Zip = True
Set oApp = createobject("Shell.Application")
oApp.NameSpace(sZipFile).CopyHere sFile2Add
If Err<>0 Then AddFile2Zip=False
End Function

Function CreateEmptyZip(sPathName)
'Create empty Zip File.
'Crea un file zip vuoto.
Dim fso, fp
Const ForWriting = 2 'Apre un file in scrittura.
CreateEmptyZip = True 'se tutto va bene resta true.
On Error Resume Next
Set fso = CreateObject("Scripting.FileSystemObject")
Set fp = fso.OpenTextFile( sPathName, ForWriting, True )
If Err <> 0 Then
Set opfs = Nothing
CreateEmptyZip=False
Exit Function 'Errore nella creazione
end if
fp.Write Chr(80) & Chr(75) & Chr(5) & Chr(6) & String(18, 0)
If Err <> 0 Then
Set opfs = Nothing
CreateEmptyZip=False
Exit Function 'errore nella scrittura
End If
fp.Close 'Chiude il file, altrimenti non si puņ usare.
Set fso = Nothing
Err.Clear
End Function

Function AddFolder2Zip (ZipFile, Folder)
'Copia il contenuto di una cartella in un file zip.
'Il folder deve essere indicato con pathname completo
'e terminare con un "\"
'Zipfile deve essere indicato con pathname completo.
AddFolder2Zip=True
Set oApp = CreateObject("Shell.Application")
'Copia il contenuto della cartella nello zip.
Set oFolder = oApp.NameSpace(Folder)
If Not oFolder Is Nothing Then
oApp.NameSpace(ZipFile).CopyHere oFolder.Items
End If
If Err <>0 Then AddFolder2Zip=False
End Function
--
Giovanni Cenati (Bergamo, Italy)
Write to "Reventlov" at katamail com
http://digilander.libero.it/Cenati (Esempi e programmi in VbScript)
--
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Is it advisable to compress winsxs folder? Vista file management
How do I compress a folder using the File System Object? VB Script
Re: Compress Folder to a single file? VB Script
Re: Compress Folder to a single file? VB Script
Compress a Folder or File Tutorials


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46