我正在使用Windows 7 64位。我有两组图像命名为:
Pro_NGF_Con_Parallel001.TIFF
Pro_NGF_Con_Parallel001.TIFF
Pro_NGF_Con_Orthogonal001.TIFF
Pro_NGF_Con_Orthogonal002.TIFF
我需要一个批处理脚本,可以根据其名称将它们排序到文件夹001
和002
。
Pro_NGF_Con_Parallel001.TIFF
Pro_NGF_Con_Orthogonal001.TIFF
Pro_NGF_Con_Parallel002.TIFF
Pro_NGF_Con_Orthogonal002.TIFF
然后我需要另一个批处理脚本来重命名每个子文件夹中的文件:
Parallel.TIFF
Pro_NGF_Con_Parallel001.TIFF
来自 Perp.TIFF
Pro_NGF_Con_Orthogonal001.TIFF
Parallel.TIFF
Pro_NGF_Con_Parallel002.TIFF
来自 Perp.TIFF
Pro_NGF_Con_Orthogonal002.TIFF
答案 0 :(得分:1)
批次1:
@echo off
setlocal enabledelayedexpansion
for /L %%a in (1000,1,1999) do (
set "num=%%a"
set "num=!num:~-3!"
if exist "*!num!.tiff" (
md "!num!" 2>nul
move "*!num!.tiff" "!num!"
)
)
批次2:
@echo off
setlocal enabledelayedexpansion
for /L %%a in (1000,1,1999) do (
set "num=%%a"
set "num=!num:~-3!"
if exist "!num!\*_Parallel!num!.tiff" ren "!num!\*_Parallel!num!.tiff" "Parallel.tiff"
if exist "!num!\*_Orthogonal!num!.tiff" ren "!num!\*_Orthogonal!num!.tiff" "Perp.tiff"
)