1.

Solve : Batch file for renaming all files inside a folder?

Answer»

does anybody know the COMMAND??u can use the command MOVE
move filename filenam2
if u need to rename all files inside a folder do this bat file

@echo off
for /F "tokens=1* delims=." %%i in ('dir /b /a-d') do (
if "%%j" NEQ "bat" move ".\%%i.%%j" ".\%%i55.%%j" )

now in stead of 55 u put the STRING u want to add to the name of ur files
and u should put the file inside the folder u want to chang its files name

Go to Dos prompt
I usually change the directory to the folder with the files in it
then use the rename command

c:\test>rename text*.* newname*.*

everything beginning with the filename 'text' will be renamed to 'newname' retaining any * fillers.

textxxx.doc will be newnamexxx.doc
text33mn.txt will be newname33mn.txt
textdada.xls will be newnamedada.xls

hi pwekn68

in ur command u should have something shared between many folder so u can rename them
but withen mine u don't

i hope that jedix10 can find a solution for his issue His question was RENAMING all files within a folder. Nothing about subfolders.Quote from: .bat_man on May 06, 2008, 03:17:54 PM

hi pwekn68

in ur command u should have something shared between many folder so u can rename them
but withen mine u don't

i hope that jedix10 can find a solution for his issue

i am sorry i typed folder instead of files
Quote from: pwekn68 on May 06, 2008, 12:56:36 PM
Go to Dos prompt
I usually change the directory to the folder with the files in it
then use the rename command

c:\test>rename text*.* newname*.*


You may also use ? in PLACE of the *. This is useful if you have a specific naming convention where you do not want to change specific characters within the filename.

For Example:

I had two files named: "igsg09op.4" and "igsg08op.5" (Yes weird extensions, but my program requires them to run properly.)
However I needed to change the names to all uppercase. Using the ? in place of the "09" or "08" within the name allows this to work:

c:\> rename igsg??op.* IGSG??OP.*

The two files changed respectively.

IF I were to use only asterisks:

c:\> rename igsg*op.* IGSG*OP.*

I would get the following filenames:

IGSG08op.4OP and IGSG09op.5OP

By the way, Thank you pwekn68. Your method helped me solve my more complex naming convention. Kudos!


Discussion

No Comment Found