PowerShell可以这样:- dir -Include *[0-9]* -Recurse | ?{$_ -is [System.IO.DirectoryInfo]} | `
- Sort FullName -Desc | %{
- $Path = $_.FullName -replace '(.+\\).+$', '$1'
- $Name = $_.Name -replace '\d+', ''
- $n = 0; $NewName = $Name
- while(test-Path -LiteralPath ($Path + $NewName)) {
- $n1 = [math]::Truncate($n/26) + 65
- $n2 = $n % 26 + 65; $n += 1
- $NewName = $Name + '_' + [char][int]$n1 + [char]$n2
- }
- move -LiteralPath $_.FullName -Dest ($Path + $NewName)
- }
复制代码
|