Solved: Updating Multiple Filenames

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

hutabarat

Thread Starter
Joined
Apr 10, 2010
Messages
3
Hi,

For simplicity, I have the following files:

ABC DEF 01_2000.TXT
ABC DEF 02_2000.TXT
ABC DEF 03_2000.TXT
ABC DEF 04_2000.TXT

in C drive.

The result that I want is like this:

ABC DEF 01.TXT
ABC DEF 02.TXT
ABC DEF 03.TXT
ABC DEF 04.TXT

So, you can see that I just need to remove the string "_2000" from each filename.

After searching in the internet, I read that in order to perform a loop I can use FOR command.
But, I am still baffled how to use it.
Any help is appreciated.

Many thanks.

Leo
 
Joined
Aug 7, 2007
Messages
9,028
Lot's of rename utilities like the one Mumbodog linked.

For a batch file, this will do it:
Code:
@Echo Off
SetLocal EnableDelayedExpansion
Set _Source=[COLOR=Red]C:\My File Folder Path Goes Here[/COLOR]
PushD "%_Source%"
For /F "Tokens=* Delims=" %%I In ('Dir /A-D /B *.txt') Do (
Set _Fname=%%~nI
Set _Fname=!_Fname:_2000=!
Ren "%%~I" "!_Fname!%%~xI"
)
PopD
 

hutabarat

Thread Starter
Joined
Apr 10, 2010
Messages
3
Hi TheOutcaste,

Your script works perfectly.

Once again many thanks.

Regards,

Leo
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Top