Solved

windows rename files

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

Forrester Webinar: xMatters Delivers 261% ROI

Guest speaker Dean Davison, Forrester Principal Consultant, explains how a Fortune 500 communication company using xMatters found these results: Achieved a 261% ROI, Experienced $753,280 in net present value benefits over 3 years and Reduced MTTR by 91% for tier 1 incidents.

Question has a verified solution.

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

Suggested Solutions

My purpose is to describe the basic concepts of virtual memory as implemented in a modern Windows-based operating system. I will also describe the problems inherent in older systems and how virtual memory solves them. The dark ages - before virtu…
When you upgrade from Windows 8 to 8.1 or to Windows 10 or if you are like me you are on the Insider Program you may find yourself with many 450MB recovery partitions.  With a traditional disk that may not be a problem but with relatively smaller SS…
This video Micro Tutorial explains how to clone a hard drive using a commercial software product for Windows systems called Casper from Future Systems Solutions (FSS). Cloning makes an exact, complete copy of one hard disk drive (HDD) onto another d…
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…

752 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