--> Devnullius's Choices: A list of default programs to keep your PC running well!
0 Members and 1 Guest are viewing this topic.
'FROM https://stackoverflow.com/questions/48159497/windows-bat-script-to-get-directory-size-if-over-n-gb-then-delete-oldest-files-t'2^30*1 means 1GB and 2^30*8 means 8GB. Below, you need to change that multiplier twice and both (logically) should be the same value 'to set your folder's maximum size in GB'And of course you need to change the folder name to match your folderSet fso = CreateObject("Scripting.FileSystemObject")Set F = fso.GetFolder("C:\Users\User\Pictures\Microsoft")If F.size > 2^30*4 Then 'Comments on a stupid editor that can't handle tabs 'Creating an in memory disconnected recordset to sort files by date Set rs = CreateObject("ADODB.Recordset") With rs .Fields.Append "Date", 7 .Fields.Append "Txt", 201, 5000 .Open For Each Thing in f.files .AddNew .Fields("Date").value = thing.datelastmodified .Fields("Txt").value = thing.path .UpDate Next .Sort = "Date Desc" Do While not .EOF fso.deletefile .Fields("Txt").Value If f.size < 2^30*4 then Exit Do .MoveNext Loop End WithEnd If
With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.
Terms of Use | Privacy Policy | Advertising