Solved

windows rename files

Posted on 2008-10-09
4
312 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Want Experts Exchange at your fingertips?

With Experts Exchange’s latest app release, you can now experience our most recent features, updates, and the same community interface while on-the-go. Download our latest app release at the Android or Apple stores today!

Question has a verified solution.

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

Many times while working on a computer regardless of any Operating System, lag and crashes seem to creep in, hindering your working speed. Sometimes, it can also cause your work to be lost unexpectedly and as a result, you are unable to meet your de…
This article covers how to install the Microsoft Windows Operating System (OS). What is covered in this article:  > Different Versions and Editions of the Windows OS  > Upgrading versus Fresh Installation of the OS           - Steps to take pr…
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…

635 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