'sets varialbes
Dim objFSO, filecsv, csvname, path, colFiles, colFolders, tmpFile, tmpPath, tmpModDate, oneLine
strFolder = "r:"
'object creation
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder(strFolder)
'creates the file. sets the path of that file.
Set filecsv = objFSO.CreateTextFile("I:\My Documents\Filemaker Script\FilemakerInventory.csv", True)
path = objFSO.GetAbsolutePathName("I:\My Documents\Filemaker Script\FilemakerInventory.csv")
'gets the name of the csv file
csvname = objFSO.GetFileName(path)
Set colFiles = objFolder.Files
For Each File in colFiles
set objFile = objFSO.GetFile(strFolder & "\" & File.Name)
Next
If lcase(Right(objFile.Name,3)) = "fmp" Then
tmpFile = objFile.Name
tmpPath = objFile.Path
tmpModDate = objFile.DateLastModified
oneLine = tmpFile & "," & tmpPath & "," & tmpModDate
filecsv.WriteLine(oneLine)
End If
If lcase(Right(objFile.Name,3)) = "fp3" Then
tmpFile = objFile.Name
tmpPath = objFile.Path
tmpModDate = objFile.DateLastModified
oneLine = tmpFile & "," & tmpPath & "," & tmpModDate
filecsv.WriteLine(oneLine)
End If
ScanSubFolders(objFolder)
'search through the directory structure of the drive
Sub ScanSubFolders(objFolder)
Set colFolders = objFolder.SubFolders
For Each objSubFolder In colFolders
Set colFiles = objSubFolder.Files
For Each objFile in Colfiles
If lcase(Right(objFile.Name,3)) = "fmp" Then
wscript.echo objFile.Name
tmpFile = objFile.Name
tmpPath = objFile.Path
tmpModDate = objFile.DateLastModified
oneLine = tmpFile & "," & tmpPath & "," & tmpModDate
filecsv.WriteLine(oneLine)
End If
If lcase(Right(objFile.Name,3)) = "fp3" Then
wscript.echo objFile.Name
tmpFile = objFile.Name
tmpPath = objFile.Path
tmpModDate = objFile.DateLastModified
oneLine = tmpFile & "," & tmpPath & "," & tmpModDate
filecsv.WriteLine(oneLine)
End If
Next
ScanSubFolders(objSubFolder)
Next
End Sub
'close the csv file
filecsv.Close
'output that goes to the command line
If objFSO.FileExists(path) Then
wscript.echo ("Your file, " & csvname & ", has been created.")