Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.
if fileName.size=0 then FSO.deletefile fileName.path,true
on error resume next ' Write what we're scanning for path = "c:\" Set FSO = CreateObject("Scripting.FileSystemObject") fileName = Replace(Replace("file-sizes_" & date() & "_" & time() & ".txt","/","-"),":","-") Set record = FSO.CreateTextFile(fileName, True) ScanDirectory FSO.GetFolder(path) record.close Sub ScanDirectory(oFolder) on error resume next ' Scan the Files in this Directory ScanFiles oFolder ' Essentially iterate in this function with any additional folder names found For each folder in oFolder.SubFolders ScanDirectory folder Next End Sub Sub Scanfiles(oFolder) on error resume next ' Checks files in a folder and outputs any that haven't been modified in x days recordNumber = 0 For each file in oFolder.Files If file.size > 5368709120 Then recordNumber = recordNumber + 1 record.WriteLine(recordNumber & " , " & file.Path & " , " & file.Size & "Bytes") End If Next End Sub
Join the community of 500,000 technology professionals and ask your questions.