[linux-help] Re: mp3 sorting issues :(
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
On Thu, 15 Apr 2004 dustin@xxxxxxxx wrote:
> I have a nice little script written to get rid of the bad characters and
> convert to underscores, but am having problems getting it to recurse.
Is it Perl or shell script? If it's shell script, just use 'find'.
Otherwise, a little lesson in recursion is necessary...
=====
#!/usr/bin/perl
sub descend;
$startpoint = '.';
descend( $startpoint );
sub descend {
my( $directory, $entry, @entries );
$directory = pop( @_ );
opendir( DIR, $directory );
@entries = readdir( DIR );
closedir( DIR );
foreach $entry ( @entries ) {
if ( -d "$directory/$entry" && $entry !~ /^\./ ) {
descend( "$directory/$entry" ); # recurse
} else {
print( "$directory/$entry\n" );
}
}
} # end of descend
=====
(There's probably some Perl module that already does this.)
--
Carl D Cravens (raven@xxxxxxxxxxx)
I don't have TIME to be charming...
-- This is the linux-help@xxxxxxxxx list. To unsubscribe,
visit http://www.complete.org/cgi-bin/listargate-aclug.cgi
- [linux-help] mp3 sorting issues :(, dustin, 2004/04/16
- [linux-help] Re: mp3 sorting issues :(,
Carl D Cravens <=
- [linux-help] Re: mp3 sorting issues :(, dustin, 2004/04/18
- [linux-help] Re: mp3 sorting issues :(, Carl D Cravens, 2004/04/18
- [linux-help] Linux antivirus, bbales, 2004/04/18
- [linux-help] Re: Linux antivirus, Michael Osten, 2004/04/19
- [linux-help] Re: Linux antivirus, Anne McCadden, 2004/04/19
- [linux-help] Re: Linux antivirus, Jesse Kaufman, 2004/04/19
- [linux-help] Re: Linux antivirus, bbales, 2004/04/19
- [linux-help] Re: Linux antivirus, Jesse Kaufman, 2004/04/22
- [linux-help] Re: Linux antivirus, James Lancaster, 2004/04/21
- [linux-help] Re: Linux antivirus, Jeff Vian, 2004/04/19
|
|