|Hello all i am trying to create a Batch file to check disk space and do the following : if enough space then exit if not enough space delete some folder except some specific folders.|
For example :
for /f "tokens=3" %%a in ('dir D: /c ^| find /i "bytes free"') do set Free=%%a
if %Free% LEQ 30.000.000.000
(it checks if the drive has less than 30gb and after i want to execute a command to delete folders to free up space except some specific ones)
i am using D: drive and my folder is D:\games so i want the batch to check D: and if space is lower than 30gb i want it to go to D:\games and delete the folders inside it but not delete specific ones for example the games folder has inside some folders like : world of warcraft, call of duty, age of empires, lineage and many more i dont want to delete for example world of warcraft folder and lineage but i want to delete all the rest folders maybe a .txt file or an .ini file to write there what folder i don't want it to delete ?
i would really appreciate your help i have searched everywhere and i cant find a solution :(