Login | |
|
 |
Re: File/Folder enumeration - 3/3/2005 4:25:19 AM
|
|
 |
|
| |
Mindmesh
Posts: 78
Score: 0
Joined: 11/23/2004
From:
Status: offline
|
Thanks for the script. I made some changes to it, so that it will output to a text file, but it only outputs from the main drive that I specify, it doesn't enumerate thru all the files in all the folders.. Here are the changes that I made. Let me know if you can help me out. Thanks again. Option Explicit On Error Resume Next Dim folder folder = Inputbox("Which drive do you want to check?") getFolder(folder) Function getFolder(root) Dim fso, folders, folder, file, files, txtFile Const Appending = 8 Set fso = CreateObject("Scripting.FileSystemObject") If fso.FolderExists(root) Then Set txtFile = fso.createtextfile("C:\Owners.txt", False) If err.number <> 0 then Set txtFile = fso.opentextfile("C:\Owners.txt", Appending) End If txtFile.WriteLine root & "," & getOwner(root) For Each file In fso.GetFolder(root).Files txtFile.WriteLine file & "," & getOwner(fso.GetAbsolutePathName(file)) Next For Each folder In fso.getFolder(root).SubFolders getFolder(fso.GetAbsolutePathName(folder)) Next Else WScript.Echo "Folder doesn't exist: " & root Exit Function End If End Function Function getOwner(object) Dim su, sd Set su = CreateObject("ADsSecurityUtility") Set sd = su.GetSecurityDescriptor(object, 1, 1) getOwner = sd.Owner End Function Thanks again.
|
|
| |
|
|
|
 |
Re: File/Folder enumeration - 3/18/2005 4:29:38 AM
|
|
 |
|
| |
kirrilian
Posts: 628
Score: 3
Joined: 3/15/2005
From:
Status: offline
|
it was horrible, lemme tell ya. but we have 200+ servers and i didnt relish collecting data from locally run scripts either... it wouldnt be so bad if it wasnt sooooo slow
|
|
| |
|
|
|
 |
Re: File/Folder enumeration - 3/18/2005 6:11:41 AM
|
|
 |
|
| |
kirrilian
Posts: 628
Score: 3
Joined: 3/15/2005
From:
Status: offline
|
quote: Originally posted by token heh..unfortunately, it is [:(!] I've done some tests in the past and I have decided never to use it again unless the objects are within a managable size. eg: <= 500
yea my boss wanted a file comparison script using wmi. [B)] *shiver* but i did it and other than the wait, it does some custom stuff that i havent seen in any commercial products.
|
|
| |
|
|
|
|
|