Re: [newbie] OT - bash-how to operate on nested directories

2002-04-07 Thread Todd Slater

On Sun, 7 Apr 2002 15:53:07 -0400
Todd Slater <[EMAIL PROTECTED]> wrote:

> I can generate a playlist using: find /tunes -type f -follow -name
> '*.ogg'-o -name '*.mp3' -o -name '*.MP3'  | sort > myplaylist.m3u. This
> includes all the files in all the folders in /tunes.
> 
> But what if I want to generate playlists for each directory under
> /tunes? I've got /tunes/mp3-blues/albert king, /tunes/mp3-blues/freddie
> king etc...
> 
> I can generate a list of directories under /tunes, but I don't know how
> to pass that on so I can do something with it. With my limited
> knowledge, I think I'll need to do a for loop (?)

After a little more digging, I managed this:

for folder in `find /tunes -type d`
do
find $folder -type f -follow -name '*.ogg' -o -name '*.mp3' -o
-name '*.MP3' | sort > $folder/playlist.m3u done

It does basically what I want it to do--generates playlists for the mp3s
and oggs in every folder and subfolder. BUT, it would be really cool if I
could get each m3u file to have a more telling name--like
talking_heads_playlist.m3u. I tried doing this with
$folder/$folder_playlist.m3u, but that $folder is the path, and I just
want the name of the current folder. (and it generated
errors--/tunes/talking_heads//tunes/talking_heads file not found)

Is it possible to pull out just the current directory (ignoring the path)
to use in the filename?

Todd (almost there)

-- 
Todd Slater
8:47pm up 11 days, 21:15, 2 users, load average: 0.35, 0.35, 0.28
School days, I believe, are the unhappiest in the whole span of human
existence. They are full of dull, unintelligible tasks, new and unpleasant
ordinances, and brutal violations of common sense and common decency.
(H.L. Mencken)



Want to buy your Pack or Services from MandrakeSoft? 
Go to http://www.mandrakestore.com



[newbie] OT - bash-how to operate on nested directories

2002-04-07 Thread Todd Slater

I'm trying to write a script to generate m3u playlists of all my mp3s and
oggs. Then I'll create a cron job so that my m3u lists get updated from
time to time.

I can generate a playlist using: find /tunes -type f -follow -name '*.ogg'
-o -name '*.mp3' -o -name '*.MP3'  | sort > myplaylist.m3u. This includes
all the files in all the folders in /tunes.

But what if I want to generate playlists for each directory under /tunes?
I've got /tunes/mp3-blues/albert king, /tunes/mp3-blues/freddie king
etc...

I can generate a list of directories under /tunes, but I don't know how to
pass that on so I can do something with it. With my limited knowledge, I
think I'll need to do a for loop (?)

Any pointers and suggestions would be very welcome.

Thanks,
Todd

-- 
Todd Slater
3:44pm up 11 days, 16:12, 2 users, load average: 0.31, 0.14, 0.11
Education is a private matter between the person and the world of
knowledge and experience, and has little to do with school or college.
(Lillian Smith)



Want to buy your Pack or Services from MandrakeSoft? 
Go to http://www.mandrakestore.com