jeffharbert icon

Recursively copy folder to date-stamped backup folder

jeffharbert | PRO | 01/05/17 07:03:56 PM UTC | 0 ⭐ | 348 👁️ | Never ⏰ | []
PowerShell |

410 B

|

None

|

0 👍

/

0 👎

## This script recursively copies a folder to a backup location.
## The name of the backup folder serves as a date stamp, using
## today's date and current UTC time to name the folder.
 
$printedDate = Get-Date -format "MM-dd-yy"
$ED=[Math]::Floor([decimal](Get-Date(Get-Date).ToUniversalTime()-uformat "%s"))
$savefilename = $printedDate + "_" + $ED
Copy-Item C:\path1 -Destination c:\path2\$savefilename -Recurse

Comments