vbsnewbie23
IS-IT--Management
As my sign-in implies I'm extremely new to scripting of any kind, but I see the usefulness and want to learn. I found this script on this blog.
'**************************************************************************
'**************************************************************************
'** **
'** Script to recursively search a folder for file types with extensions **
'** **
'**************************************************************************
'**************************************************************************
strDir = "SET DIRECTORY SEARCH ROOT HERE"
Set FSO = Wscript.CreateObject("Scripting.FileSystemObject")
getInfo(strDir)
'wscript.Echo "Search Complete"
'**************************************************************************
'** Subroutine to match file name to list of set file extensions **
'**************************************************************************
Sub SearchFiles(aItem)
Select Case LCase(Right(Cstr(aItem.Name), 3))
Case "mp3", "avi", "mov", "m4a", "m4b", "aac", "mpg"
wscript.Echo "FILE FOUND: " & aItem.Name
End Select
End Sub
'**************************************************************************
'** Subroutine to search folders recursively from the root set above **
'**************************************************************************
Sub getInfo(strDir)
Set objDir = FSO.GetFolder(strDir)
For Each FileItem In objDir.Files
SearchFiles(FileItem)
Next
For Each NextFileItem In objDir.SubFolders
' wscript.Echo "Parsing Folder: " & NextFileItem.Name
getInfo(NextFileItem)
Next
End Sub
Can someone explain to me how many scripts this is? This doesn't delete the file, correct?
Thanks in advance!
'**************************************************************************
'**************************************************************************
'** **
'** Script to recursively search a folder for file types with extensions **
'** **
'**************************************************************************
'**************************************************************************
strDir = "SET DIRECTORY SEARCH ROOT HERE"
Set FSO = Wscript.CreateObject("Scripting.FileSystemObject")
getInfo(strDir)
'wscript.Echo "Search Complete"
'**************************************************************************
'** Subroutine to match file name to list of set file extensions **
'**************************************************************************
Sub SearchFiles(aItem)
Select Case LCase(Right(Cstr(aItem.Name), 3))
Case "mp3", "avi", "mov", "m4a", "m4b", "aac", "mpg"
wscript.Echo "FILE FOUND: " & aItem.Name
End Select
End Sub
'**************************************************************************
'** Subroutine to search folders recursively from the root set above **
'**************************************************************************
Sub getInfo(strDir)
Set objDir = FSO.GetFolder(strDir)
For Each FileItem In objDir.Files
SearchFiles(FileItem)
Next
For Each NextFileItem In objDir.SubFolders
' wscript.Echo "Parsing Folder: " & NextFileItem.Name
getInfo(NextFileItem)
Next
End Sub
Can someone explain to me how many scripts this is? This doesn't delete the file, correct?
Thanks in advance!