Configuring Automation Bot for checking free hard disk space and deleting safe folders

Are you concerned about running out of space on your C drive frequently and the time it takes to manually clean up your hard disk.
In following steps we will configure an Automation Process to find free disk space in our C drive and then delete the folder which are safe to delete

  1. Add a Power shell activity. Use following cmd let to get free size
    Get-Volume -DriveLetter C | Format-List -Property SizeRemaining
    This will return a string value SizeRemaining : 123456789. Say we take this value in outRes argument

  2. Add a assign activity and assign this to a String argument ( DiskRem)
    Split(outRes,“:”)(1).Trim()

  3. Add another Assign activity and assign this to a Double argument
    Double.Parse(DiskRem) / (1024 X 1024 X 1024)
    This will give you the Free Disk size in GB

  4. Now using a conditional statement (if else block) check if Free Disk Size is less than threshold say (10 GB)

  5. Using File operations Delete interaction delete the files present in following folder. Usually files under these are safe to delete to clean up space. ( Kindly do a double check on your side to be sure)

C:\Users<>\Downloads
C:\Users<>\AppData\Local\Temp
C:\Windows\Temp

You can safely delete log file of any installed programs also which are not of any use to you