Home Man
Search
Today's Posts
Register

BSD, Linux, and UNIX shell scripting — Post awk, bash, csh, ksh, perl, php, python, sed, sh, shell scripts, and other shell scripting languages questions here.

Script to add extension to filename

Tags
shell scripts

Login to Reply

 
Thread Tools Search this Thread
# 1  
Old 07-22-2011
Script to add extension to filename

Hi all,

I have a folder with a bunch of files in them, and I would like to add an extension (.mp3)to all these filenames. The folder has only files that I'd like .mp3 added to.

It looks something like this:

Intput:
Code:
File1
File2
File3

Output:
Code:
File1.mp3
File2.mp3
File3.mp3

Thanks in advance!
# 2  
Old 07-22-2011
Code:
find ./folder -type f -exec mv '{}' '{}.mp3' ';'

The Following User Says Thank You to Corona688 For This Useful Post:
repiv (07-22-2011)
# 3  
Old 07-22-2011
Hi,
you can try
Code:
for i in File*
do
mv $i $i.mp3
done


Last edited by radoulov; 07-22-2011 at 05:37 PM.. Reason: Code tags, please!
The Following User Says Thank You to mauregato For This Useful Post:
repiv (07-22-2011)
Login to Reply

« Previous Thread | Next Thread »
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
[BASH] Getting a filename its extension sea Shell Programming and Scripting 7 05-07-2015 04:58 AM
Get latest filename without extension sumang24 Shell Programming and Scripting 7 12-11-2012 02:38 PM
Rename all files (filename with spaces) to different extension mac4rfree Shell Programming and Scripting 1 06-13-2012 03:05 AM
removing the filename extension daflore Shell Programming and Scripting 5 03-03-2011 04:43 PM
Getting filename with entire path without extension amicableperson Shell Programming and Scripting 3 01-16-2011 08:13 PM
cut filename extension Essbaumer Shell Programming and Scripting 4 07-29-2010 05:18 AM
script takes the whole filename instead of just extension wolverine999 UNIX for Dummies Questions & Answers 1 05-20-2009 02:49 PM
changing filename extension Hiso Shell Programming and Scripting 3 01-24-2009 08:02 AM
separating filename and extension lucaspewkas Shell Programming and Scripting 2 04-06-2007 07:07 AM
filename extension check - regular expression devs Shell Programming and Scripting 4 03-02-2007 02:01 PM


All times are GMT -4. The time now is 11:28 PM.

Unix & Linux Forums Content Copyright©1993-2018. All Rights Reserved.
UNIX.COM Login
Username:
Password:  
Show Password