daily pastebin goal


a guest Dec 16th, 2018 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $ErrorActionPreference = "Stop"
  2. #If there is a error stop!
  3. $theFolder = Read-Host -Prompt "Enter folder location you wish to backup"
  4. # variable 'theFolder' = the entered file location.
  5. $question = Read-Host -Prompt "Would you like to backup another folder? 'Y' or 'N'"
  6. if ($question -eq 'Y') {$moreFolder = Read-Host "Enter second folder location"} else
  7. # variable 'backup' = the entered backup location
  8. {$backup = Read-Host -Prompt "Enter backup location"}
  9. echo $thefolder
  10. echo $backup
  11. echo $moreFolder
  12. # checking to see if there is a connection there.
  13. Test-Path $theFolder
  14. Test-Path $moreFolder
  15. Test-Path $backup
  16. # testing the path of both the folder and backup location
  17. Copy-Item -Path $theFolder* -Destination $backup -Recurse
  18. Copy-Item -path $moreFolder* -Destination $backup -Recurse
  19. # copy via file pathway defined ealier. put into destination staging.
  20. # recurse = bypass all prompts (are you sure etc)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand