2015. 1. 13. 21:54
VBS - 특정 디렉터리 내 파일 개수 쿼리 (매개 변수) Etc.2015. 1. 13. 21:54
Set oArgs = WScript.Arguments
If oArgs.Count = 0 Then
WScript.Echo "Argument was not provided."
WScript.Quit
End If
strDirectory = ""
If oArgs.Count > 1 Then
For i = 0 to oArgs.Count - 1
strDirectory = strDirectory & oArgs(i) & " "
Next
Else
strDirectory = oArgs(0)
End If
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set Folder = oFSO.GetFolder(strDirectory)
Set Files = Folder.Files
NumOfFiles = Files.Count
Set Files = NOTHING
Set Folder = NOTHING
Set oFSO = NOTHING
WScript.Echo strDirectory & vbCRLF
WScript.Echo "# of Files: " & NumOfFiles