ExamNotes.net  -  IT certification portal

ForumsCertResearchTop sitesNewslettersFree email
HomeRegister
Exams Notes
Practice exams
Exam games
Questions by email
Online training
Training videos
College degrees
Boot camps
Book store
Links directory
Tell a friend
For webmasters

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






This is interesting: Free IT Magazines | Databases help forum



General discussions > Programming Forum > VbScript Question

Show a Printable Version
Email This Page to Someone!
Receive updates to this thread






Author VbScript Question
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

Old Post 03-03-05 07:54 PM
mindmesh is offline Click Here to See the Profile for mindmesh Click here to Send mindmesh a Private Message Add mindmesh to your buddy list Find more posts by mindmesh    mindmesh's ICQ status    Reply w/Quote Edit/Delete Message IP: Logged
All times are GMT.
Post new thread   Post reply

Featured site: MCSE, MCSD, CompTIA, CCNA training videos



Forum Jump:
Rate This Thread:
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


Powered by: vBulletin 2.2.8
Copyright ©2000, Jelsoft Enterprises Limited.

  Free Braindumps | mcse braindumps