Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $ErrorActionPreference = "Stop"
- #If there is a error stop!
- $theFolder = Read-Host -Prompt "Enter folder location you wish to backup"
- # variable 'theFolder' = the entered file location.
- $question = Read-Host -Prompt "Would you like to backup another folder? 'Y' or 'N'"
- if ($question -eq 'Y') {$moreFolder = Read-Host "Enter second folder location"} else
- # variable 'backup' = the entered backup location
- {$backup = Read-Host -Prompt "Enter backup location"}
- echo $thefolder
- echo $backup
- echo $moreFolder
- # checking to see if there is a connection there.
- Test-Path $theFolder
- Test-Path $moreFolder
- Test-Path $backup
- # testing the path of both the folder and backup location
- Copy-Item -Path $theFolder* -Destination $backup -Recurse
- Copy-Item -path $moreFolder* -Destination $backup -Recurse
- # copy via file pathway defined ealier. put into destination staging.
- # recurse = bypass all prompts (are you sure etc)
Add Comment
Please, Sign In to add comment