copy more files + remove force
This commit is contained in:
1 file changed
+16
-1
Regular → Executable
+16
-1
@@ -14,7 +14,22 @@ pscp.exe -l root -scp -pw $PASSWD -r 192.168.100.1:/etc/ldlda_help $PSScriptRoot
|
|||||||
pscp.exe -l root -scp -pw $PASSWD 192.168.100.1:/etc/rc.local $PSScriptRoot
|
pscp.exe -l root -scp -pw $PASSWD 192.168.100.1:/etc/rc.local $PSScriptRoot
|
||||||
pscp.exe -l root -scp -pw $PASSWD -r 192.168.100.1:/etc/wakey-agent $PSScriptRoot
|
pscp.exe -l root -scp -pw $PASSWD -r 192.168.100.1:/etc/wakey-agent $PSScriptRoot
|
||||||
|
|
||||||
Remove-Item -Recurse (Join-Path $PSScriptRoot "root")
|
$uciDir = Join-Path $PSScriptRoot 'uci-config'
|
||||||
|
New-Item -ItemType Directory -Force -Path $uciDir | Out-Null
|
||||||
|
# This ignored backup contains credentials; do not add it to version control.
|
||||||
|
pscp.exe -l root -scp -pw $PASSWD 192.168.100.1:/etc/config/wakey (Join-Path $uciDir 'wakey')
|
||||||
|
|
||||||
|
$rootBackup = Join-Path $PSScriptRoot 'root'
|
||||||
|
if (Test-Path -LiteralPath $rootBackup) {
|
||||||
|
# Router backups include hidden/read-only files. Fail once if deletion is
|
||||||
|
# genuinely blocked rather than merging a fresh copy into a partial backup.
|
||||||
|
try {
|
||||||
|
Remove-Item -LiteralPath $rootBackup -Recurse -Force -ErrorAction Stop
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
throw "Cannot remove previous router backup '$rootBackup': $($_.Exception.Message)"
|
||||||
|
}
|
||||||
|
}
|
||||||
pscp.exe -l root -scp -pw $PASSWD -r 192.168.100.1:/root $PSScriptRoot
|
pscp.exe -l root -scp -pw $PASSWD -r 192.168.100.1:/root $PSScriptRoot
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user