copy more files + remove force

This commit is contained in:
lda committed 2026-10-09 23:22:20 +07:00 Verified
1 parent 9814754e50
commit 6b6050d1c1
1 file changed
+16 -1
Regular → Executable
+16 -1
View File
@@ -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 -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