Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

windows rename files

Posted on 2008-10-09
4
Medium Priority
?
315 Views
Last Modified: 2012-05-05
I have to rename (WINDOWS) various files
The names are *-11.jpg such as foto1-11.jpg and I would like to get foto1.jpg

ex:
foto-11.jpg
foto-me-11.jpg

RESULT:
foto.jpg
foto-me.jpg

Any idea ?
0
Comment
Question by:yarek
  • 2
4 Comments
 
LVL 3

Accepted Solution

by:
tdor earned 1500 total points
ID: 22680688
Hello yarek,

Irfan view might be able to help you. You can download it from http://www.irfanview.com/

A tutorial on how to use it's rename feature here:
http://www.techtorials.com/desktop_apps/irfanview/using_batch_rename_option_in_irfanview-1556-view.htm


Regards,

tdor
0
 
LVL 38

Expert Comment

by:Shift-3
ID: 22680904
Paste the script below into a text file with a .cmd extension.  Customize the value of the folder variable with the location of the folder containing the .jpg files.  Running the script will echo commands to remove the -11 suffix from each filename.  Once you have tested it successfully, remove the ECHO from line 8 to rename the files.


@echo off
setlocal enabledelayedexpansion
 
set folder=c:\files
set mask=*-11.jpg
 
for /F "tokens=*" %%G in ('dir "%folder%\%mask%" /A:-D /B') do (
 set newname=%%~nG
 ECHO ren "%folder%\%%G" "!newname:~0,-3!%%~xG"
)
 
pause

Open in new window

0
 
LVL 38

Expert Comment

by:Shift-3
ID: 22681038
That should be remove the ECHO from line 9 to rename the files.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

by Nathan Brom/Bromy2004 Introduction There are numerous websites out there for any different type of program you can imagine.  Of those, you'll need to decide which ones are legitimate and aren't trying to steal your money or infect your comput…
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
In this video, we discuss why the need for additional vertical screen space has become more important in recent years, namely, due to the transition in the marketplace of 4x3 computer screens to 16x9 and 16x10 screens (so-called widescreen format). …
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

971 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question