I took photos with a digital camera, and all the photo names are SAM_00**.JPG. How can I make a batch file to remove the SAM_ from all the photo names and turn them into 00**.JPG
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!
@echo off
setlocal EnableDelayedExpansion
for /f "delims=" %%i in ('dir /b /a-d *.jpg') do (
ren %%i !%%i:SAM_=!
)
pauseOriginally posted by chinesechrist at 2010-8-3 22:07:
I took photos with a digital camera, and all the photo names are SAM_00**.JPG. How can I make a batch file to remove the SAM_ from all the photo names and turn them into 00**.JPG
ren sam_*.jpg " *.jpg"

, it actually created files whose names begin with half-width spaces.Originally posted by chinesechrist at 2010-8-4 17:59:
ren sam_*.jpg " *.jpg"
Tested and works on Windows XP sp3
---------but the filename has four extra spaces
xren jpg "/ /gi" "_"
xren txt "/^/" www.cn-dos.net_
xren txt "/_www\.example\.com\.txt$/" ".txt"