LoneRanger has asked for the wisdom of the Perl Monks concerning the following question:
@dirs = qx {ls -R \/HD\/MP3 | grep \:};
foreach $dir (@dirs)
{
chomp $dir;
$dir =~ s/://;
$dir = "\"" . $dir . "\"";
@files = qx {cd $dir ; ls *.mp3 ; cd \/HD\/MP3\/};
$dir =~ s/"//g;
print "$dir
\n";
foreach $file (@files)
{
print "$file
";
}
}
I had to use the nested foreach() because I wanted the dir name outdented, I tried indenting the filenames using \t, but I must not know enough to even get that right. Yes I know my tags have spaces in them, that's the only way I could get them to show up on the post.
For it to work you need to replace /HD/MP3 in lines 1 and 7 with a dir containing some MP3s and some album subdirs.
Thanks in advance,
JR Boyens
Self Proclaimed Perl Newbie
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE: Easier way to do this
by mwp (Hermit) on Aug 18, 2000 at 01:02 UTC | |
|
RE: Easier way to do this
by steveAZ98 (Monk) on Aug 18, 2000 at 01:00 UTC | |
by LoneRanger (Acolyte) on Aug 18, 2000 at 08:48 UTC | |
|
RE: Easier way to do this
by KM (Priest) on Aug 18, 2000 at 17:11 UTC | |
|
Re: Easier way to do this
by deprecated (Priest) on Feb 04, 2001 at 11:57 UTC | |
|
Re: Easier way to do this
by Shendal (Hermit) on Aug 18, 2000 at 01:12 UTC | |
by Anonymous Monk on Aug 18, 2000 at 06:47 UTC | |
by Corion (Patriarch) on Aug 18, 2000 at 11:48 UTC |