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

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

0 views
Skip to first unread message

Larry

unread,
Dec 1, 2008, 2:40:01 PM12/1/08
to
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.

Matthias Tacke

unread,
Dec 1, 2008, 4:19:19 PM12/1/08
to

This vb program (easily found with google) might inspire you ;-)
http://www.visualbasic.happycodings.com/Files_Directories_Drives/code8.html

BigDaddyJim

unread,
Dec 2, 2008, 7:50:53 AM12/2/08
to
> This vb program (easily found with google) might inspire you ;-)http://www.visualbasic.happycodings.com/Files_Directories_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")

Larry

unread,
Dec 2, 2008, 9:39:01 AM12/2/08
to
Thanks.
0 new messages