Advertisement

05.28.2008 at 08:58AM PDT, ID: 23438549
[x]
Attachment Details

Help me use BASH  to strip filename extension.

Asked by toben88 in Unix Operating Systems, Linux

Hello,

My script needs to name all files in a directory to .flv
However this keeps the old extension so filename.mpg becomes filename.mpg.flv

Help me edit the script so filename.mpg becomes filename.flv

#!/bin/bash
for movie in /var/www/html/files/encode/flv*.* ; do
    NEWNAME=`basename $movie`.flv
    NEWPATH=/var/www/html/files/encoding/flv/$NEWNAME
    FINALPATH=/var/www/html/files/encoded/flv/$NEWNAME
    echo Processing $movie
    echo -- New name is $NEWNAME
    echo -- New path is $NEWPATH
    echo -- Final path is $FINALPATH
done
Start Free Trial
[+][-]05.28.2008 at 09:24AM PDT, ID: 21661873

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.28.2008 at 09:42AM PDT, ID: 21662011

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.28.2008 at 09:52AM PDT, ID: 21662095

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.28.2008 at 09:56AM PDT, ID: 21662131

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.28.2008 at 11:40AM PDT, ID: 21663054

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Unix Operating Systems, Linux
Sign Up Now!
Solution Provided By: MikeOM_DBA
Participating Experts: 5
Solution Grade: A
 
 
[+][-]05.28.2008 at 02:16PM PDT, ID: 21664458

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.29.2008 at 09:58AM PDT, ID: 21671016

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628