返回列表 发帖
本帖最后由 newswan 于 2023-4-21 01:04 编辑
$fld = "."
if ( $fld -like "?:*" ) {
$p = $fld
} else {
$p = Join-Path $PSScriptRoot $fld
}
Set-Location $p
[string]$p = Get-Location
Get-ChildItem -Recurse -Directory $p | ForEach-Object {
if ( -not ( Get-ChildItem -Directory -Path $_.fullname )) {
$p2 = $_.fullname.Substring( $p.Length +1 )
$NewName = Join-Path $_.Parent.FullName ( $p2 -replace "\\","-" )
Write-Host "--" $_.fullname.Substring( $p.Length +1 )
write-Host "  " $NewName.Substring( $p.Length +1 )
# Rename-Item $_.fullname -NewName $NewName
}
}COPY
第一行是 要处理的目录
如果正确 删除17行前的#

TOP

返回列表