- $sour = "颜勤礼碑单字版"
- $destDictory = ".\a"
- $rulefile = "汉字偏旁-rule.txt"
-
- $rule = Get-Content -Encoding UTF8 -Path $rulefile
-
- Get-ChildItem -Path $sour | ForEach-Object {
- $char = $_.basename -replace "\d",""
- $name =$_.fullname
- $dest = $rule -match ("\t.*" + $char) -replace "\t.*",""
- $dest | foreach-object {
- $dd = $destDictory + "\" + $_
- if (-not (test-path $dd))
- {
- New-Item -ItemType "directory" $dd
- }
- copy-item $name $dd
- }
- pause
- }
复制代码
|