Copy-Item (based on the creationtime property) Tagged: copy-item, Creationtime, filter This topic contains 3 replies, has 2 voices, and was last updated by Don Jones 1 year, 11 months ago. Author Posts October 14, 2015 at 5:57 am #30786 Stephen MurphyParticipant Hello Forum, I am very new to powershell, I started learning yesterday. I have been playing around with the "Copy-Item" cmdlet, and like what I can do with it. I wondered if there was a way of copying files, based on their Property "CreationTime" as I can already do with copying spefic file types? I have been playing with both the -Filter and -Exclude paramaters but with no luck so far. So example. copy from C:\testfolder1\ to C:\testfolder2 but only copy files from 2014. I would be greatful for any help you can offer. Kind Regards Stephen Murphy October 14, 2015 at 5:59 am #30787 Don JonesKeymaster -Filter and -Exclude operate against the filename. You'll need an interim filter. Get-ChildItem c:\source | Where-Object CreationTime -gt [datetime]'1/1/2001' | Copy-Item c:\destination Something vaguely like that, conceptually. October 14, 2015 at 6:08 am #30791 Stephen MurphyParticipant Don, thats lovely thank you, I think I understand a bit better now. Can you do the same with -gt "12 months" or "30 days" or does it have to be specific dates? October 14, 2015 at 6:13 am #30793 Don JonesKeymaster No, you have to have an actual value. It's just like comparing two numbers. But you can make one. $tomorrow = (Get-Date).AddDays(1) Pretty sure it's all in "Learn PowerShell in a Month of Lunches" if you want to explore deeper :). Author Posts You must be logged in to reply to this topic.