How mass rename files in Windows 7

I recently recovered and cleaned some data that was infected with a version of cryptolocker. Now all of my files are as follows:

filename.exe.doc
filename.exe.xls
filename.exe.pdf

All the files are definitely clean and open up without issue, but the names are confusing my client.

Is there a way to remove only the .exe from the filenames on a mass scale?
PcdynamixAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

NVITCommented:
Assumes:
- All filenames have name format: filename.ext.ext

Assuming you have of files.txt containing the names of your files:

IMPORTANT: For visual confirmation, this code has an ECHO prefixing REN. To run it for real, remove the ECHO prefix.

c:\local\filename.exe.doc
c:\local\filename.exe.xls
c:\local\filename.exe.pdf
c:\local\SUB\filename.exe.pdf

Open in new window

Make a .bat file of this:

for /f %%a in (files.txt) do (
  for /f "tokens=1-9 delims=." %%A in ("%%a") do (
    ECHO ren "%%~a" "%%A.%%C"
  )
)

Open in new window


Update: This version creates files.txt, which reads the filenames from a folder. Just change SrcDir variable to your needs:
set SrcDir=c:\folder

dir /s /b "%SrcDir%">files.txt

for /f %%a in (files.txt) do (
  for /f "tokens=1-9 delims=." %%A in ("%%a") do (
    ECHO ren "%%~a" "%%A.%%C"
  )
)

Open in new window

0
akbCommented:
There is a free program call BulkRenameUtility available from http://www.bulkrenameutility.co.uk/Main_Intro.php

It is very powerful and has plenty of options. It even gives you a preview of what is going to change before you commit so you can be certain you have everything right.
0
EirmanChief Operations ManagerCommented:
Flash Renamer is I believe the best renamer you can get.
Try a 30 day trial. There are no limits during the trial.
SETTINGS For Deleting Last 4 Characters Of FilenamesIn the above settings, it is set to remove four characters from the filename counting backwards from the end.
At the top, note that the file extension is not selected (nor folders) for processing ..... just the filename.
Look at the preview on the right.

Important:  you can UNDO a batch rename.

At the moment, all files in W: will be processed, but it is easy to manually select (or filter for) chosen files.

It's a superb program - If you try it, I'll bet you buy it!
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

BillDLCommented:
Excellent suggestion Eirman.  For $19.95, £13.09, or 17.72 Euros, that's an impressive program.  I do like the fact that "you can UNDO a batch rename", which is something that is most often missing in free and paid-for programs, and is a worry to people when using command line batch files or scripts.  I might buy it myself.
0
PcdynamixAuthor Commented:
Thanks Eirman, Exactly what I was looking for. Very powerful.
0
EirmanChief Operations ManagerCommented:
Thanks Pcdynamix. Some useful tips:

You can select the files to be processed from Windows Explorer, then
Right click and select .... Flash Renamer > Start & Load Selected Files from the context sensitive menu.
--------------------------------------------------------------------------------------------------------------
If you choose to process sub-folders, all the files will be listed in a flat-file structure
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows 7

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.