Тёмный

Auto-Delete of old files with VBS file 

BodriG
Подписаться 5 тыс.
Просмотров 26
50% 1

' ? -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

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии    
Далее
Why Are Open Source Alternatives So Bad?
13:06
Просмотров 654 тыс.
The Unreasonable Effectiveness of Linux Workstations
12:47
Counter-Strike 2 - Новый кс. Cтарый я
13:10
Yəni, sizcə, indi bu nə deməkdir?
0:23
Просмотров 82 тыс.
Skoda Octavia III 1.4 TSI  - Coolant change
13:38
When you Accidentally Compromise every CPU on Earth
15:59
3 Hours vs. 3 Years of Blender
17:44
Просмотров 5 млн
How Math Becomes Difficult
39:19
Просмотров 68 тыс.
How Fast Can I Fill My Inbox?
13:30
Просмотров 354 тыс.
My 10 “Clean” Code Principles (Start These Now)
15:12
how to study less and get higher grades
11:16
Просмотров 726 тыс.
Dear Game Developers, Stop Messing This Up!
22:19
Просмотров 720 тыс.
Adobe is horrible. So I tried the alternative
25:30
Просмотров 1,1 млн