LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 08-08-2003, 07:39 AM   #1
jamie_barrow
Member
 
Registered: Jul 2003
Location: Gauteng, South Africa
Distribution: Windows XP, yup :D Will be back onto Ubuntu probably someday
Posts: 107

Rep: Reputation: 15
Got a script to rename a batch of files?


Does anybody have a script that can let me change the extension of multiple files in one go?

eg. rename *.tgz *.tar.gz
 
Old 08-08-2003, 07:52 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975
Code:
for i in *.tar.gz
do
  mv $i `basename $i .tar.gz`.tgz
done
should do the trick
 
  


Reply


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with Bash Script - Rename Multiple Files embsupafly Programming 16 04-02-2010 04:50 AM
Batch Script to rename files... jamie_barrow Linux - Newbie 16 06-14-2009 02:26 PM
rename script all files in dir Longinus Linux - Newbie 8 08-02-2004 01:24 AM
Batch rename question hellblade Linux - Software 4 05-03-2004 04:57 PM
Need script to rename files joe_stevensen Programming 5 12-05-2003 07:12 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

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

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