











CompTIA
Exam Vouchers
Save money on CompTIA exams
| Question of the day
Sign up to receive
interactive practice questions
for MCSE, CompTIA
Cisco and other exams
| TestKing
Get MCSE, MCSD, CCNA, CCNP,A+, N+ and many more | * ExamSheets *
Guide for Success!
Actual Questions & Answers
MCSE, MCSD, A+ ,CCNA, CCNP
Oracle 8i, Oracle 9i Online practice tests
Certification sites Online university Online college Online education Distance learning Software forum Server administration forum Programming resources
|
|  |
mindmesh
Spit Fire M

Registered: Aug 2002 Location: Philadelphia Country: United States State: Certifications: A+, MCP, MCSA +S, MCSE Working on: CCNA, LPI, RHCE
Total Posts: 1623
|
|
VbScript Question
This script only enumerates the files in a specified folder, how do I get it to enumerate thru all folders and output the files? Thanks.
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
Attachment: new text document.txt
This has been downloaded 0 time(s).
__________________
I take no responsibility for the offensive nature of this post.. If you take offense I am sorry, but honestly don't give a damn. All rights reserved!!
Report this post to a moderator
|
|
03-03-05 07:54 PM
|
|
|
Featured site: MCSE, MCSD, CompTIA, CCNA training videos
Forum Rules: Who Can Read The Forum? Any registered user or guest.
Who Can Post New Topics? Any registered user.
Who Can Post Replies? Any registered user.
Changes: Messages can be edited by their author.
Posts: HTML code is OFF. Smilies are ON. vB code is ON. [IMG] code is OFF. |
|
ExamNotes forum archive
|