WinXP file renaming

Post Reply
GORDON
Site Admin
Posts: 56735
Joined: Sun Jun 06, 2004 10:43 pm
Location: DTManistan
Contact:

Post by GORDON »

Is there any quick way to take a folder full of jpg's with spaces in the names (ex - "death valley.jpg") and rename all the files by replacing the space with, say, an underscore?
"Be bold, and mighty forces will come to your aid."
thibodeaux
Posts: 8121
Joined: Thu May 20, 2004 7:32 pm

Post by thibodeaux »

vbscript, maybe.
User avatar
Cakedaddy
Posts: 9301
Joined: Thu May 20, 2004 6:52 pm

Post by Cakedaddy »

Do CMD batch files still work?

Use the ren command in one.
Zetleft
Posts: 563
Joined: Fri May 21, 2004 6:43 pm
Location: Texas

Post by Zetleft »

Ok googled this little batch file workaround for ya, yeah I'm that bored right now.

Create any batch file, named mine test.bat and put this in it (or course change to the directory name you gonna be using), this is just gonna call another batch file, and I had all the images in the testbatch folder so name that whatever folder your files are gonna be in:

Code: Select all

@echo off

for /r D:\testbatch\ %%K in (*.gif) do call D:\testbatch\rename.bat "%%K"

pause
exit
and create anther batch file that does the renaming, called mine rename.bat as you can tell from the code.

rename.bat

Code: Select all

@ECHO OFF
REM Set the File name without ext to Flenme variable
Set Flenme="%~n1"
REM Set Extn to extension only
Set Extn=%~x1
REM Replace Spaces with underscores
Set Flenme=%Flenme: =_%
ECHO %~nx1 Changed to %Flenme%%Extn%
REM Now Rename the file
REN "%~f1" %Flenme%%Extn%
Worked fine in my winxp computer and it didn't blow up or anything.[/color]



Edited By Zetleft on 1141893232
Paul
Posts: 8458
Joined: Fri May 21, 2004 5:02 pm
Location: KY
Contact:

Post by Paul »

I use Lupas Rename for that sort of stuff.
It works great. Lots and lots of options.




Edited By Paul on 1141911045
Post Reply