Need to create a script to copy the latest version of a folder to an external drive.
hi all,
im quite new powershell, trying create script run each sunday copy our directory external drive.
$backup2 = "v:\xxxxx\xxxxxxx 2014-12-13 08;03;56 (full)\*"
$dest = "b:\"
copy-item -path $backup -destination $dest
only problem folder change name every week.
how run without modifying script each week?
thanks in advance.
you go level , grab folder latest lastwritetime, should ensure ever newest folder -
$path = (gci <path> | sort lastwritetime -descending | select -index 0).fullname
Windows Server > Windows PowerShell
Comments
Post a Comment