Looking for a script that will delete folders or files.

filmoore54

New Member
Looking for a script that will delete daily backup folders or files. Id like to use task scheduler to run it on a daily basis...
 
You would need to be a lot more specific.

*POWERSHELL*
Remove-Item -Path 'C:\Somepath' -Recurse
Would be enough to delete the directory C:\Somepath. If it needs to look at MAC times and delete based on that you could do some some simple filtering with Where-Object.
 
If I understand it correctly, then the following statements would do what I am attempting...I just have to figure out the variables in order to do it on a daily basis and then create a task to run it...

Folder
Remove-Item -Path 'B:\DBBackups\2021-08-30_22-00-02' -Recurse

File
Remove-Item -Path 'F:\Backup\FullBackup09072021' -Recurse
 
Back
Top