Computing.Net > Forums > Disk Operating System > Rename files ina particular folder

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Rename files ina particular folder

Reply to Message Icon

Name: DOS_User
Date: July 9, 2009 at 16:03:35 Pacific
OS: Windows XP
Subcategory: General
Comment:

Hi,

I have to rename all the files in a particular
folder. I am able to rename it only one file and
the other files gets ignored. Could some one
help me with the code ?

FOR %%l in (D:\Test\*.*) do (SET
FNAME=%%~nxl) & call:rename

:rename
ren %FNAME% test.%FNAME:~4%.txt

This does rename (remove existing prefix and
add a new prefix) for the first file in the folder
but how to continue the same process for the
rest of the files ?

Could someone please let me know ...



Sponsored Link
Ads by Google

Response Number 1
Name: Mechanix2Go
Date: July 9, 2009 at 16:23:02 Pacific
Reply:

Answered in programming using for /f which is OK for XP but NG for DOS.

There is no %%~N in DOS.


=====================================
If at first you don't succeed, you're about average.

M2


0
Reply to Message Icon

Related Posts

See More


batch file File Management program


Use following form to reply to current message:

Login or Register to Reply
LoginRegister


Sponsored links

Ads by Google


Results for: Rename files ina particular folder

copy files excluding particular ext www.computing.net/answers/dos/copy-files-excluding-particular-ext/15756.html

rename files www.computing.net/answers/dos/rename-files/14038.html

copy or move and rename files www.computing.net/answers/dos/copy-or-move-and-rename-files/13772.html