Heres the perl equivalent:

#!/usr/bin/perl -w

#
# script to process all mp3 files under a given directory or directories
#

use File::Find;
no warnings 'File::Find';

#the @array holds the dirs you want to search, you can specify  
multiple dirs here or just one,
#uncomment appropriate one
[EMAIL PROTECTED] = ("/path/to/your/directory/", "/path/to/your/ 
directory2/");
@directories_to_search = "/path/to/your/directory/";

find(\&processFiles, @directories_to_search);

#this function is called on every file and dir that is found under the
sub processFiles() {

     #check if its a .mp3 file
     if ($_ =~ /(mp3)$/) {
        #the filename found is stored in $_ so we can use that directly
        $command = "lame -b 64 -f -m s $_ stream_$_";
        $result = `$command`;
     }
}







On 04/08/2006, at 12:40 PM, Warren Toomey wrote:

> On Thu, Aug 03, 2006 at 06:29:12PM -0400, Ken wrote:
>> such I've added code to re-encode mp3's as they are being  
>> uploaded, but all
>> for the existing mp3's, is it possible in the Linux shell to use  
>> maybe grep
>> or something to go though all the folders and re-encode every  
>> single mp3 one
>> at a time using this command
>>  lame -b 64 -f -m s SongName.mp3 stream_SongName.mp3
>
> Write a script called /tmp/z like this
>
> #!/bin/sh
> infile=$1
> dir=`dirname $infile`
> base=`basename $infile`
> outfile="$dir/stream_$base"
> lame -b 64 -f -m s $infile $outfile
>
> Make it executable, and test it with a single input file.
> Now apply it to the whole directory:
>
> find dir -name '*.mp3' -exec /tmp/z {} \;
>
> where dir is the top-level directory name.
>
> Cheers,
>       Warren
> _______________________________________________
> mp3encoder mailing list
> [email protected]
> https://minnie.tuhs.org/mailman/listinfo/mp3encoder

_______________________________________
Steve Swinsburg
Programmer
Teaching & Learning Centre
University of New England, Armidale, 2351
[EMAIL PROTECTED]
t: +612 6773 2922  f: +612 6773 3269


_______________________________________________
mp3encoder mailing list
[email protected]
https://minnie.tuhs.org/mailman/listinfo/mp3encoder

Reply via email to