• Uncategorized
  • 0


Time to move or even delete some old files from your file server? Here´s an example of a PowerShell script that looks after files older than the value specified in $Date variable.

You can exclude files with the $PathToExclude variable that I’ve written in some RegEx format. Just add folders you want to exclude.

All files that are older than the value specified will be moved to the $Target variable and the script will create the same folder structure as the source the files came from. This way it’s easier to find the files you didn’t mean to move 🙂

I’ve added two Write-Progress bars, hope you find them useful.

The script logs the actions and puts the result in a CSV file and also a HTML file. The HTML file will show the excluded folders at the top of the page.



You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: