[dba-Tech] Empty folders

Mitsules, Mark S. (Newport News) Mark.Mitsules at ngc.com
Tue Sep 21 09:43:38 CDT 2004


Jon,

I'm sorry I don't have time at the moment to generate a working solution,
but if you are familiar with scripting, you should be able to patch
something together with this stuff.  These are all examples taken from the
System Administration Scripting Guide.


Mark


**************************

Enumerate All the Folders on a Computer

Description
Returns a list of all the folders on a computer. This can take 15 minutes or
more to complete, depending on the number of folders on the computer.

Script Code 

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colFolders = objWMIService.ExecQuery("Select * from Win32_Directory")
For Each objFolder in colFolders
    Wscript.Echo objFolder.Name
Next

**************************

Enumerate Folder Properties

Description
Demonstration script that uses the FileSystemObject to enumerate the
properties of a folder. Script must be run on the local computer.

Script Code 

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder("C:\Scripts")
Wscript.Echo "Date created: " & objFolder.DateCreated
Wscript.Echo "Date last accessed: " & objFolder.DateLastAccessed
Wscript.Echo "Date last modified: " & objFolder.DateLastModified
Wscript.Echo "Drive: " & objFolder.Drive
Wscript.Echo "Is root folder: " & objFolder.IsRootFolder
Wscript.Echo "Name: " & objFolder.Name
Wscript.Echo "Parent folder: " & objFolder.ParentFolder
Wscript.Echo "Path: " & objFolder.Path
Wscript.Echo "Short name: " & objFolder.ShortName
Wscript.Echo "Short path: " & objFolder.ShortPath
Wscript.Echo "Size: " & objFolder.Size
Wscript.Echo "Type: " & objFolder.Type

**************************

Delete a Folder

Description
Demonstration script that uses the FileSystemObject to delete a folder.
Script must be run on the local computer.

Script Code 

Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.DeleteFolder("C:\FSO")

**************************

Use Recursion to Enumerate Subfolders

Description
Demonstration script that uses the FileSystemObject to recursively list all
the subfolders (and their subfolders) within a folder. Script must be run on
the local computer.

Script Code 

Set FSO = CreateObject("Scripting.FileSystemObject")
ShowSubfolders FSO.GetFolder("C:\Scripts")
Sub ShowSubFolders(Folder)
    For Each Subfolder in Folder.SubFolders
        Wscript.Echo Subfolder.Path
        ShowSubFolders Subfolder
    Next
End Sub
**************************



-----Original Message-----
From: Jon Tydda [mailto:Jon.Tydda at alcontrol.co.uk] 
Sent: Tuesday, September 21, 2004 10:07 AM
To: Dba-Tech (E-mail)
Subject: [dba-Tech] Empty folders


Hi all, does anyone know of a way to find empty folders in win2k?
 
I'm re-ripping a lot of my cd collection, and some of the tracks/albums are
being named more correctly as the online catalogs are more up to date than
before, which is leaving me with a lot of empty folders. I have deleted the
ones in the main tree, but as for going through all the artists folders and
deleting the empty album names, that's going to be a pain... I was thinking
that there has to be an easier way to do it than just looking...
 
 
Jon


The information in this e-mail is confidential and may also be legally
privileged. The contents are intended for recipient only and are subject
to the legal notice available on request from : webmaster at alcontrol.co.uk
ALcontrol Laboratories is a trading division of ALcontrol UK Limited.
Registered Office: Templeborough House, Mill Close, Rotherham, S60 1BZ.
Registered in England and Wales No 4057291
_______________________________________________
dba-Tech mailing list
dba-Tech at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/dba-tech
Website: http://www.databaseadvisors.com



More information about the dba-Tech mailing list