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 - How do I compress a folder using the File System Object?

Reply
 
Old 12-01-2008   #1 (permalink)
Larry


 
 

How do I compress a folder using the File System Object?

I'm experimenting with setting folder attributes using the FSO. I've been
able to set the other attributes but not compression. Shouldn't it be as easy
as:

Dim objFolder, objFSO
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder("C:\Scripts")
objFolder.Attributes = 2048

I don't get any errors, just nothing happens. I can hide the folder and turn
on the archive flag using this method.

My System SpecsSystem Spec
Old 12-02-2008   #2 (permalink)
BigDaddyJim


 
 

Re: How do I compress a folder using the File System Object?

On Dec 1, 3:19*pm, Matthias Tacke <Matth...@xxxxxx> wrote:
Quote:

> Larry wrote:
Quote:

> > I'm experimenting with setting folder attributes using the FSO. I've been
> > able to set the other attributes but not compression. Shouldn't it be as easy
> > as:
>
Quote:

> > Dim objFolder, objFSO
> > Set objFSO = CreateObject("Scripting.FileSystemObject")
> > Set objFolder = objFSO.GetFolder("C:\Scripts")
> > objFolder.Attributes = 2048
>
Quote:

> > I don't get any errors, just nothing happens. I can hide the folder andturn
> > on the archive flag using this method.
>
> This vb program (easily found with google) might inspire you ;-)http://www.visualbasic.happycodings....es_Drives/code...
WMI does this pretty easily. Get the WMI Code Creator. Google for
it. It's a real time saver.

strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root
\CIMV2")
Set objShare = objWMIService.Get("Win32_Directory.Name='c:\'")
Set objOutParams = objWMIService.ExecMethod("Win32_Directory.Name='c:
\dell'", "Compress")
My System SpecsSystem Spec
Old 12-02-2008   #3 (permalink)
Larry


 
 

Re: How do I compress a folder using the File System Object?

Thanks.

"BigDaddyJim" wrote:
Quote:

> On Dec 1, 3:19 pm, Matthias Tacke <Matth...@xxxxxx> wrote:
Quote:

> > Larry wrote:
Quote:

> > > I'm experimenting with setting folder attributes using the FSO. I've been
> > > able to set the other attributes but not compression. Shouldn't it be as easy
> > > as:
> >
Quote:

> > > Dim objFolder, objFSO
> > > Set objFSO = CreateObject("Scripting.FileSystemObject")
> > > Set objFolder = objFSO.GetFolder("C:\Scripts")
> > > objFolder.Attributes = 2048
> >
Quote:

> > > I don't get any errors, just nothing happens. I can hide the folder and turn
> > > on the archive flag using this method.
> >
> > This vb program (easily found with google) might inspire you ;-)http://www.visualbasic.happycodings....es_Drives/code...
>
> WMI does this pretty easily. Get the WMI Code Creator. Google for
> it. It's a real time saver.
>
> strComputer = "."
> Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root
> \CIMV2")
> Set objShare = objWMIService.Get("Win32_Directory.Name='c:\'")
> Set objOutParams = objWMIService.ExecMethod("Win32_Directory.Name='c:
> \dell'", "Compress")
>
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Retrieve File System Object Descriptions For Executables PowerShell
Re: Compress Folder to a single file? 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