Solved

windows rename files

Posted on 2008-10-09
4
308 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 500 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

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…
The password reset disk is often mentioned as the best solution to deal with the lost Windows password problem. In Windows 2008, 7, Vista and XP, a password reset disk can be easily created. But besides Windows 7/Vista/XP, Windows Server 2008 and ot…
Windows 8 comes with a dramatically different user interface known as Metro. Notably missing from the new interface is a Start button and Start Menu. Many users do not like it, much preferring the interface of earlier versions — Windows 7, Windows X…
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…

914 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now