Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 8583

Copy Files and Folder to New Location

$
0
0

I am trying to copy certain files that fall within a specific date range to a different location.   The command I have works but dumps all the files in the root of the destination.  I am trying to get it to copy the source folder as well. 

Get-ChildItem -Path "C:\temp\Sourcetest\" -filter "*.*" -Recurse | Where-Object {$_.lastwritetime -gt "2/05/2014" -and $_.LastWriteTime -lt "3/02/2014"} | Copy-Item -Destination "D:\DestinationTest" -Recurse

I also can easily do this using robocopy but was wondering if I can get it working in powershell.


Viewing all articles
Browse latest Browse all 8583

Trending Articles