Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 02-01-2009, 09:26 PM   #1
Registered: Oct 2008
Posts: 190

Rep: Reputation: 16
Renaming multiple files

I have many files named (number).jpg that I want to rename to (number)_sm.jpg (thumbnails, "sm" is short for "small").

How do I do this via shell? I've tried futzing around with mv, rename and wildcards characters, but it's getting me nowhere.
Old 02-01-2009, 09:58 PM   #2
LQ Newbie
Registered: May 2006
Distribution: Slackware
Posts: 10

Rep: Reputation: 0
try this:

for f in *.jpg ; do mv $f ${f%.jpg}_sm.jpg; done


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
renaming multiple files linuxhippy Slackware 10 01-21-2011 01:53 AM
renaming multiple files yanchina12 Linux - Newbie 5 12-21-2007 07:56 AM
Renaming multiple files ajcns Linux - Newbie 2 01-19-2007 11:04 PM
renaming multiple files in general kkatebian Linux - General 5 11-06-2005 11:05 AM
Renaming multiple files with the same format Shr00mBoXx Slackware 7 06-20-2004 07:22 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:01 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration