1.

Solve : How do i change the file names of a bunch of files...?

Answer»

I need HELP changing the file names of a bunch of FILES in my computer. I have files wherein the beginning of the file is DIFFERENT but the end is all of the same series. For example:

7201_Home_2008.txt ===> 7201_Home.txt
5562_Home_2008.txt ===> 5562_Home.txt
6678_Home_2008.txt ===> 6678_Home.txt
6679_Home_2008.txt ===> 6679_Home.txt

I want to remove the "_2008" on all of those files leaving the beginning of the filename and the extension name intact. Please help me...

Thank you and God Bless...


At the command prompt,

Code: [Select]for /f "tokens=1,2,3 delims=_" %f in ('dir /b *_2008.txt') do ren "%f_%g_%H" "%f_%g.txt"
In a BATCH, double up the percent signs so e.g. %f becomes %%f
Sorry, but it's not working. Do you have any more ideas?Couldn't test this because CMD isn't working for some ****** unknown reason but let me know if this is correct:

Code: [Select]@echo off
cd "H:\dos test"
cls
ren 7201_Home_2008.txt>>7201_Home.txt
ren 5562_Home_2008.txt>>5562_Home.txt
ren 6678_Home_2008.txt>>6678_Home.txt
ren 6679_Home_2008.txt>>6679_Home.txt
pause
exit
Do a search on "Bulk Rename Utility" - IIRC it's a freebie and does a fairly good job of batch processing for filenames.

Not perfect but - still very useful.Quote from: Mr. Google on September 01, 2008, 09:08:28 PM

Couldn't test this because CMD isn't working for some ****** unknown reason but let me know if this is correct:

Code: [Select]@echo off
cd "H:\dos test"
cls
ren 7201_Home_2008.txt>>7201_Home.txt
ren 5562_Home_2008.txt>>5562_Home.txt
ren 6678_Home_2008.txt>>6678_Home.txt
ren 6679_Home_2008.txt>>6679_Home.txt
pause
exit

No it is not right. The >> characters are wrong, and should be replaced by a space.
ok thanks


Discussion

No Comment Found