批量删除文件名中包含 "diffusionImage" 字符的部分
使用方法:
- 创建一个txt文件
- 黏贴代码 保存
- 将后缀
txt
改为bat
运行
@echo off
setlocal enabledelayedexpansion
set "targetFolder=C:\Users\Lenovo\Desktop\thumbnail" REM 替换目标文件夹路径
cd /d "%targetFolder%"
for %%F in (*diffusionImage*) do (
set "filename=%%~nF"
set "extension=%%~xF"
set "newFilename=!filename:diffusionImage=!"
ren "%%F" "!newFilename!!extension!"
echo Renamed: "%%F" to "!newFilename!!extension!"
)
echo All files with 'diffusionImage' in their names have been renamed.
pause