Hello Bokke,
I assume you have some familiarity with the command line interface and
can create text files with an editor. If you need help with that or
any other part of the answer - please use a clarification request.
The basic script you ask for is:
#!/bin/sh
find $1 -name "*" -print
Using a text editor (vi, emacs, ed), create a text file with those two
lines. If you named the file list.sh, then use:
chmod +x list.sh
to make the script executable.
Assume the script is named list.sh, your music files are in the
"music" directory under your home directory, and started with a
command like
list.sh ~/music
for the explanation that follows:
- the first line indicates you want to use the shell program at
/bin/sh (bourne shell)
- the second line indicates you want to run the find program. The
music directory (~/music) will replace $1 in the command line
generating
find ~/music -name "*" -print
as the command to be executed. As I noted in the request for question
clarification, the format of output will be one line per music file,
sorted by artist and album. If the output is not sorted, change the
second line to read
find $1 -name "*" -print | sort
to sort the result.
If you want just one album printed, change the command line to
list.sh ~/music/Artist1/Album1
or if you want just one artist printed, change the command line to
list.sh ~/music/Artist2
as appropriate.
As shown, the output of the script will appear on the screen. If you
want to save this into a file, change the command line to
list.sh ~/music > music.dir
to capture the output in music.dir.
For more information about scripts and other utlities I suggest
reviewing
man bash
or
man sh
[varies by type of Unix / Linux system]
man find
on your system. Alternatively, you may get on line sites using phrases
such as:
bourne shell script description
bourne shell script tutorial
or check more general sites such as
http://www.devdaily.com/unix/edu/index.shtml
which have more general tutorials and training materials.
--Maniac |