hi there. i have to write some script that will accept a path and then search through that path and all subdirectories for specific file types.
So far, to test my logic, I just assumed that we'll only have 2 levels of subdirectories. the pseudocode looks like:
set fso = file system object
strpathToCheck= topLevelPath (eg. c:\mydirectory> )
ofiles = fso.getfiles(strPathToCheck)
for each file in ofiles
check file type. if it's asp, process it.
next
if fso.hasfolders(strPathtoCheck) then
ofolders = fso.getfolders(strPathToCheck)
for each subfolder in ofolders
check each file
next
End if
The problem is that each subfolder can have multiple subfolders. can you suggest how i can write a reuseable function that it will search through all subfolders and return with a list of files that need to be checked, or will check each one as it finds them?
Thanks.
So far, to test my logic, I just assumed that we'll only have 2 levels of subdirectories. the pseudocode looks like:
set fso = file system object
strpathToCheck= topLevelPath (eg. c:\mydirectory> )
ofiles = fso.getfiles(strPathToCheck)
for each file in ofiles
check file type. if it's asp, process it.
next
if fso.hasfolders(strPathtoCheck) then
ofolders = fso.getfolders(strPathToCheck)
for each subfolder in ofolders
check each file
next
End if
The problem is that each subfolder can have multiple subfolders. can you suggest how i can write a reuseable function that it will search through all subfolders and return with a list of files that need to be checked, or will check each one as it finds them?
Thanks.