Copy files and their paths based on file date

I have a folder with 50 folders in it. Each folder has a ton of files dating to a year ago. I need to find all files in each of the 50 folders that are older then 6 months and then move them to a new location. The caveat is I need them moved into the same folder structure. The 50 folders can change each time this script is ran so it will have to copy the folder structure over and then move the files older then 6 months to the new location, with the same folder names. Sorry, having a hard time explaining this so I hope this is good.

I was hoping to be able to use a powershell script to do this.

$TIME - (Get-Date).AddDays(-180)
Get-ChildItem -Recurse |
Where-Object {$_.LastWriteTime -lt $time}

This is what I have so far.

Thanks in advance,

George Jackson

Can we assume that your question is answered?

Moving Files while copying the folder structure

I believe we can assume my question is answered. Thank you very much!

Hah, that’s funny, I was going to suggest using Robocopy when you posted, but didn’t since it isn’t PowerShell :wink: