[20160727][文件夹重命名]
Linux文件夹重命名 renameDIR.sh
#!/bin/bash i=0 for directory in ./abc/* do if [ -d $directory ] then echo "Processing $directory DIR..." mv $directory `echo $i | awk '{printf("./abc/%06d\n",$0)}'` i=`expr $i + 1` fi done
Linux文件重命名 renameImage.sh
#!/bin/bash #重命名img文件夹下的图片 for directory in ./NIRface3/* do if [ -d $directory ] then i=0 for file in $directory/*.jpg do echo "Processing $file file..." mv $file $directory/$i.jpg i=`expr $i + 1` done fi done
window文件重名名 rename.bat
echo off rem 启用"延缓环境变量扩充" setlocal EnableDelayedExpansion set a=1 rem 循环当前目录下所有图片的文件名,支持带空格的名称 for /f "delims=" %%i in ('dir /b *.bmp') do ( rem 如果没有相同的文件名,则继续 if not "%%~ni"=="%~n0" ( if !a! LSS 10 (ren "%%i" "!a!.bmp") else ren "%%i" "!a!.bmp" rem 设置数值型变量a=a+1 set /a a+=1 ) ) echo 批量重命名完成! pause