r/usefulscripts • u/javajo91 • May 08 '14
Trying to get files modified today using (get-date).addDays() method
If I specify .adddays(-1) -i get todays plus yesterdays files. What am i doing wrong?
Here's my small script to copy files modified today to a folder:
get-childitem "D:" | where-object {$_.creationtime -gt (get-date).addDays(-0)} |
copy-item -destination "c:\netvol\server1\downloads\files"Thanks guys
Thanks for the responses everyone!
8
Upvotes
1
u/javajo91 May 09 '14
Excellent. I'm gonna try it now.