PowerShell: Copy Most Recent File and Rename

$source = '<path>'
$destination = '<path>'

@(Get-ChildItem $source -Filter *.bak | Sort LastWriteTime-Descending)[0] | % { Copy-Item -path $_.FullName -destination $("$destination\CMSOPEN_backup.bak") -force } 

Post a Comment

2 Comments