本帖最后由 newswan 于 2024-6-12 09:36 编辑
Powershell- $sour = "D:\work"
- Push-Location -Paht $sour
- Get-ChildItem -Filter "*.txt" | ForEach-Object {
- $str = $_.BaseName -replace ".*?([a-zA-Z]{2,}).*",'$1'
- if ( -Not ( Test-Path $str ) ) {
- New-Item -Type Directory -Path $str
- }
- Move-Item -Path $_ -Destination $str
- }
- Pop-Location
复制代码
|