[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

OT: scripting question



Hello all,
What I'd like to end up with is a short script that will scan my music
directories and output to a file.  I'd like this to strip off the full
path and any ending extension, and ideally leave a blany\k line in
between directories.  The best I can do so far is :
ls -R /home/mp3 | (read filename; while [ ! -z "$filename" ]; do echo "${filename//mp3/ }" >> mp3.list; read filename; done)
This strips the extensions (almost all mp3's - built up from before I
found out about Ogg Vorbis), but I'm left with the full path and no
blank line between directories.  I seem to think the blank line could be
inserted by a "if filename is a directory, then echo "$filename" >>
mp3.list followed by \n", but I can't quite work out how to do it.  man
bash is giving me a headache, and I thought I'd turn to you guys and
gals.
Any thoughts?
TIA
Steve

Attachment: pgp9zWnEmAkxZ.pgp
Description: PGP signature


Reply to: