jeffharbert

Recursively copy folder to date-stamped backup folder

Jan 5th, 2017
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ## This script recursively copies a folder to a backup location.
  2. ## The name of the backup folder serves as a date stamp, using
  3. ## today's date and current UTC time to name the folder.
  4.  
  5. $printedDate = Get-Date -format "MM-dd-yy"
  6. $ED=[Math]::Floor([decimal](Get-Date(Get-Date).ToUniversalTime()-uformat "%s"))
  7. $savefilename = $printedDate + "_" + $ED
  8. Copy-Item C:\path1 -Destination c:\path2\$savefilename -Recurse
Advertisement
Add Comment
Please, Sign In to add comment