asked on
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
ASKER
on error resume next
' Write what we're scanning for
path = "c:\"
strOutput = ""
Set FSO = CreateObject("Scripting.FileSystemObject")
ScanDirectory FSO.GetFolder(path)
if strOutput <> "" then
fileName = Replace(Replace("file-sizes_" & date() & "_" & time() & ".txt","/","-"),":","-")
Set record = FSO.CreateTextFile(fileName, True)
record.Write strOutput
record.close
end if
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
strOutput = strOutput & recordNumber & " , " & file.Path & " , " & file.Size & "Bytes" & vbCrLf
End If
Next
End Sub
~bp
ASKER
This topic area includes legacy versions of Windows prior to Windows 2000: Windows 3/3.1, Windows 95 and Windows 98, plus any other Windows-related versions including Windows Mobile.
TRUSTED BY
5368709120 KB is a very large file. 5 Tera byte file?
Are you really looking for files of this magninute? do they exist on your system.
I do not see an issue in your code.
Try to test your code with a smaller number . Lets says 10000000