Solved

windows rename files

Posted on 2008-10-09
4
307 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
Comment Utility
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
Comment Utility
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
Comment Utility
That should be remove the ECHO from line 9 to rename the files.
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

The way I use Experts Exchange to assist me in analyzing and diagnosing a problem is I first enter a Verbose Question at Experts Exchange like: Office 2007 will hang when opening and saving files I then launch WordPad (any text editor will do) an…
Many admins will agree: WSUS is is a nice invention but using it on the client side when updating a newly installed computer is still time consuming as you have to do several reboots and furthermore, the procedure of installing updates, rebooting an…
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 came with a dramatically different user interface known as Metro. Notably missing from that interface was a Start button and Start Menu. Microsoft responded to negative user feedback of the Metro interface, bringing back the Start button a…

763 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

9 Experts available now in Live!

Get 1:1 Help Now