fix: 调整 NAS 部署配置与脚本清理逻辑
This commit is contained in:
@@ -33,7 +33,18 @@ function Ensure-Command {
|
||||
function Reset-Directory {
|
||||
param([string]$Path)
|
||||
if (Test-Path $Path) {
|
||||
[System.IO.Directory]::Delete($Path, $true)
|
||||
Get-ChildItem -LiteralPath $Path -Recurse -Force -ErrorAction SilentlyContinue | ForEach-Object {
|
||||
$_.Attributes = $_.Attributes `
|
||||
-band (-bnot [System.IO.FileAttributes]::ReadOnly) `
|
||||
-band (-bnot [System.IO.FileAttributes]::Hidden) `
|
||||
-band (-bnot [System.IO.FileAttributes]::System)
|
||||
}
|
||||
$rootItem = Get-Item -LiteralPath $Path -Force
|
||||
$rootItem.Attributes = $rootItem.Attributes `
|
||||
-band (-bnot [System.IO.FileAttributes]::ReadOnly) `
|
||||
-band (-bnot [System.IO.FileAttributes]::Hidden) `
|
||||
-band (-bnot [System.IO.FileAttributes]::System)
|
||||
Remove-Item -LiteralPath $Path -Recurse -Force
|
||||
}
|
||||
New-Item -ItemType Directory -Path $Path | Out-Null
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user