Delete files from folder older than any days from PowerShell script

This article is very simple and short, so the main goal is to delete (clean up) automatically any file from a specific folder older than any days wanted.

PowerShell script

To achieve that, you can get the script from my GitHub repository:

guimatheus92/Delete-Files-from-Folder: With this PowerShell script you can delete files from folder within a certain time period (

For the script to work, you just have to define how many days you want to filter to delete files on the line below.

You also need to paste the folder path where the files are located on the line below.

And that’s it! Now we can automate this task easily.

Mechanical Engineer Business Intelligence developer, passionate about technology, I have knowledge and experience to create a BI architecture and much more 📚.