DestroyerNr1
IS-IT--Management
Hi,
I want to search for files bigger than 10MB or equal on a terminal server. All the files found (also in the subsubsub... folders) must be put in an excel file.
The info of the files i look for is name, size, type, last modified and last accessed.
I found a script on that maybe will do the work but it doesn't put it in a xls file and the messageboxes must go away... the script must be modified.
here it is:
Dim FSO, WSH, objDirectory, objFile, TheFiles
Set FSO = CreateObject("Scripting.FileSystemObject")
Set WSH = CreateObject("Wscript.Shell")
Set objDirectory = FSO.GetFolder("c:\")
Set TheFiles = objDirectory.Files
Parentfolder = mid(fso.GetFolder(objDirectory),InstrRev(fso.GetFolder(objDirectory),"\",-1,0)+1,len(fso.GetFolder(objDirectory)) - InstrRev(fso.GetFolder(objDirectory),"\",-1,0))
objextension = InputBox("Enter extension" & vbcrlf & vbcrlf & ".*" & vbcrlf & "mp3" & vbcrlf & "bmp" & vbcrlf & "exe")
If FSO.FileExists ("c:\FileNames " & Parentfolder & ".txt") then
FSO.DeleteFile "c:\FileNames " & Parentfolder & ".txt"
End If
Set txtFileName = FSO.CreateTextFile ("c:\FileNames " & Parentfolder & ".doc",TRUE)
Set txtFileName = Nothing
Set txtFileName = FSpenTextFile("c:\FileNames " & Parentfolder & ".doc", 8)
WorkWithSubFolders objDirectory
txtFileName.Close
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Sub WorkWithSubFolders(objDirectory)
Dim MoreFolders, TempFolder
ListFilesWithExtension objDirectory
Set MoreFolders = objDirectory.SubFolders
For Each TempFolder In MoreFolders
WorkWithSubFolders TempFolder
Next
End Sub
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Sub ListFilesWithExtension(objDirectory)
Dim TheFiles
Set TheFiles = objDirectory.Files
For Each objFile in TheFiles
strExt = fso.GetExtensionName(objFile.Path)
If (strExt = objextension) Then
txtFileName.writeline objFile.Path & vbtab & objFile.Size & vbtab & objFile.DateCreated & vbtab & objFile.DateLastModified
end if
Next
End Sub
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Hope someone can help me out here!
I want to search for files bigger than 10MB or equal on a terminal server. All the files found (also in the subsubsub... folders) must be put in an excel file.
The info of the files i look for is name, size, type, last modified and last accessed.
I found a script on that maybe will do the work but it doesn't put it in a xls file and the messageboxes must go away... the script must be modified.
here it is:
Dim FSO, WSH, objDirectory, objFile, TheFiles
Set FSO = CreateObject("Scripting.FileSystemObject")
Set WSH = CreateObject("Wscript.Shell")
Set objDirectory = FSO.GetFolder("c:\")
Set TheFiles = objDirectory.Files
Parentfolder = mid(fso.GetFolder(objDirectory),InstrRev(fso.GetFolder(objDirectory),"\",-1,0)+1,len(fso.GetFolder(objDirectory)) - InstrRev(fso.GetFolder(objDirectory),"\",-1,0))
objextension = InputBox("Enter extension" & vbcrlf & vbcrlf & ".*" & vbcrlf & "mp3" & vbcrlf & "bmp" & vbcrlf & "exe")
If FSO.FileExists ("c:\FileNames " & Parentfolder & ".txt") then
FSO.DeleteFile "c:\FileNames " & Parentfolder & ".txt"
End If
Set txtFileName = FSO.CreateTextFile ("c:\FileNames " & Parentfolder & ".doc",TRUE)
Set txtFileName = Nothing
Set txtFileName = FSpenTextFile("c:\FileNames " & Parentfolder & ".doc", 8)
WorkWithSubFolders objDirectory
txtFileName.Close
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Sub WorkWithSubFolders(objDirectory)
Dim MoreFolders, TempFolder
ListFilesWithExtension objDirectory
Set MoreFolders = objDirectory.SubFolders
For Each TempFolder In MoreFolders
WorkWithSubFolders TempFolder
Next
End Sub
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Sub ListFilesWithExtension(objDirectory)
Dim TheFiles
Set TheFiles = objDirectory.Files
For Each objFile in TheFiles
strExt = fso.GetExtensionName(objFile.Path)
If (strExt = objextension) Then
txtFileName.writeline objFile.Path & vbtab & objFile.Size & vbtab & objFile.DateCreated & vbtab & objFile.DateLastModified
end if
Next
End Sub
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Hope someone can help me out here!