Categories
Uncategorized

Windows PowerShell copy local directory to network drive where items created TODAY

The following script will copy a local directory with items created TODAY to a network share.

Copy and paste below code to a file ending with .ps1 and run from Powershell as Admin

$path = "C:\LOCALPATHTOFOLDER\"
$Destination = "\\NETWORKSHARE\FOLDER"
Get-ChildItem -Path $path | Where-Object {$_.CreationTime.Date -eq (Get-Date).Date} | Copy-Item -Destination $Destination -Recurse -Force
Write-Host "I've just copied the file to $Destination"