本帖最后由 WHY 于 2018-9-22 12:58 编辑
- dir E:\Test\ -Include *.jpg, *.tif -Recurse | ?{$_.Name -like ($_.Directory.Name + '*')} | ren -NewName {$_.Name + '_'};
- dir E:\Test\ -Include *.jpg, *.tif, *.jpg_, *.tif_ -Recurse | group DirectoryName | ForEach{
- $fd = $_.Name -replace '.*\\';
- $n = 1000;
- $_.Group | ForEach{ ren $_ -NewName ($fd + '-' + ('' + ++$n).SubString(1) + ($_.Extension -replace '_$')); }
- }
复制代码
|