pharaoh fortune slot
Welcome, Guest. Please login or register.
December 15, 2018, 12:38:55 PM

Login with username, password and session length
* Home Help Search Login Register
|-+  General discussions
| |-+  Programming Forum
| | |-+  VbScript Question
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] Print
Author Topic: VbScript Question  (Read 1319 times)
Spit Fire
Hero Member
Offline Offline

Posts: 1623


View Profile
« on: March 03, 2005, 04:54:29 PM »

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?")

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))
For Each folder In fso.getFolder(root).SubFolders
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

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!!
Pages: [1] Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.13 | SMF © 2006-2011, Simple Machines LLC Valid XHTML 1.0! Valid CSS!