' ? -check
'----------------------------------------------------------------
const Drivename = "C:"
const MinGB = 65
const days_older = 60
const byteToGb = 1073741824
FolderArray = Array("C:\?", _
"C:\??")
Dim msgtext, sFile, oFSO, oShell
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set d = oFSO.GetDrive(Drivename)
Set oShell = CreateObject("Wscript.Shell")
strComputerName = oShell.ExpandEnvironmentStrings( "%COMPUTERNAME%" )
If (d.FreeSpace / byteToGb) ? MinGB Then
For Each Fa in FolderArray
If oFSO.FolderExists(Fa) Then
WScript.Echo Fa
For Each sFile In oFSO.GetFolder(Fa).Files
WScript.Echo sFile
If sFile.DateLastModified ? DateAdd("d", (days_older * -1), Now) Then
WScript.Echo "File name: " & sFile.Name & vbCrLf & " Last Modify date: " _
& sFile.DateLastModified & vbCrLf & " Create date: " & sFile.DateCreated & vbCrLf & cstr(DateAdd("d", (days_older * -1), Now))
oFSO.DeleteFile(sFile)
End If
Next
Else
msgtext = msgtext & " The folder: " & Fa & " not exist on computer: " & strComputerName & "!" _
& vbCrLf
End If
Next
End If
If (d.FreeSpace / byteToGb) ? MinGB Then
msgtext = msgtext & " After deleting Files the free space is still less than " & MinGB & _
"GB "& vbCrLf & " Free space: " & FormatNumber((d.FreeSpace / byteToGb), 2) & "GB " & vbCrLf & " On computer: "& _
strComputerName & "!"
End If
If msgtext ?? "" Then
WScript.Echo msgtext
End If
-----------------------------------------------------------
How to support the channel:
Donate to our PayPal:
paypal.me/Gabo...
Subscribe to my youtube channel:
www.youtube.com...
----
20 окт 2024