Introduction
This script is made for automatically cleaning folders.
Getting Started
You can create a scheduled task to automatically clean a folder.
If you create a scheduled task using Auto_cleanup.ps1, you can clean a single folder (recursively). You can use the Path argument to define a path, and use the daystokeep argument to define the amount of days that files and folders should be kept. Example: Auto_cleanup.ps1 -path D:\folder -daystokeep 7
If you create a scheduled task using Master_Cleanup.ps1, you can define multiple paths and the amount of days files and folders should be kept within the path. Paths, amount of days and the name of the blockfile can be defined in folders.csv. Warning: contains example.
What it does
It deletes all filders and folders within a single (auto_cleanup.ps1) or multiple (Master_Cleanup.ps1 with folders.csv). It also creates a placeholder which says that all files and folders will be removed within the defined timeframe. it also gives the possibility to create a file to block the script from running (like for troubleshooting purposes).
Arguments
Blockfile: define the name of the file that can be used to block the script from running
Path(mandatory): Define the path where the script needs to clean
Daytstokeep(mandatory): The amount of days that it will keep info
All arguments are mandatory when using Master_Cleanup.ps1