Microsoft® Windows® 2000 Scripting Guide
« Previous | Next »
The previous two topics generating a list of all the folders on a computer, and generating a list of all the subfolders contained in a specified folder illustrate basic forms of folder management. Unfortunately, real-world folder management does not always fall into such tidy categories. Instead, folder management often requires you to search through the entire file system looking for folders that meet specific criteria.
For example, you might need to return a list of all the encrypted folders or all the compressed folders on a computer, regardless of their physical location. With the FileSystemObject, this type of task can be achieved only by methodically retrieving each folder on each drive and then checking to see whether it meets the criteria.
WMI makes it much easier to return a list of folders meeting specific criteria; all you have to do is include the criteria within your WQL query. For example, this query returns a collection of all the compressed folders on a computer:
SELECT * FROM Win32_Directory WHERE Compressed = True
Listing 11.4 contains a script that returns a list of all the hidden folders on a computer. To carry out this task, the script must perform the following steps:
To limit data retrieval to hidden folders, a Where clause is included restricting the returned folders to those for which the Hidden property is True.
Listing 11.4 Enumerating a Specific Set of Folders
|
|
Send us your feedback | « Previous | Next » |