Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Determine Encryption / Compression of NTFS Folder?

Status
Not open for further replies.

PScottC

MIS
Mar 16, 2003
1,285
US
I'm looking for a way to determine whether or not a folder is encrypted or compressed. The Scripting.FileSystemObject object doesn't appear to be able to expose this information.

Anyone tried this?

PSC

Governments and corporations need people like you and me. We are samurai. The keyboard cowboys. And all those other people out there who have no idea what's going on are the cattle. Mooo! --Mr. The Plague, from the movie "Hackers
 
I'm actually interested in the [blue]encrypted[/blue] status of the folder. Here's my test code... The folder referenced has the following attributes: encrypted, archive, read-only.

Code:
Dim objFSO, objFolder, strFolder

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder("C:\Documents and Settings\testuser\Favorites")

strFolder = objFolder.Attributes
WScript.Echo strFolder

The result that I get is 49, which indicates only archive and read-only.

PSC

Governments and corporations need people like you and me. We are samurai. The keyboard cowboys. And all those other people out there who have no idea what's going on are the cattle. Mooo! --Mr. The Plague, from the movie "Hackers
 
Ok... Thanks to Script-o-Matic, I think that I have found a way...

Code:
Set objWMIService = GetObject("winmgmts:\\.\root\CIMV2")
Set colItems = objWMIService.ExecQuery("SELECT Caption FROM Win32_Directory WHERE" _
	& " Drive = 'c:' and Path LIKE '%Favorites%' and Encrypted = 'true'", _
	"WQL", wbemFlagReturnImmediately + wbemFlagForwardOnly)

For Each objItem In colItems
	WScript.Echo "Caption: " & objItem.Caption
Next



PSC

Governments and corporations need people like you and me. We are samurai. The keyboard cowboys. And all those other people out there who have no idea what's going on are the cattle. Mooo! --Mr. The Plague, from the movie "Hackers
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top