LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Find command - multiple file types (https://www.linuxquestions.org/questions/linux-general-1/find-command-multiple-file-types-460399/)

mrclisdue 07-02-2006 07:20 PM

Find command - multiple file types
 
Hey all,

I've racked my head against the wall long enough, so I'll throw this over to someone wiser.

I've been using the find command to create a playlist:

Code:

find  /directory/Archived/Music -name "*.*" -print > playlist.txt
This, of course, results in all the files in the music directory being placed in the playlist.txt file.

What I'd really like to do is to find all the music files - mp3, ogg, flac, etc., and generate the playlist.txt file.

I've tried various combinations and permutations:

Code:

find  /directory/Archived/Music -name "*.mp3 *.flac *.ogg" -print > playlist.txt
etc

but, alas, no success.

Help, please.


cheers,

homey 07-02-2006 07:39 PM

Here's an example from my backup script.
Code:

find /mnt/backup -type f \( -name '*.gz' -o -name '*.log' \) \
-mtime +90 -exec rm {} \;


mrclisdue 07-02-2006 08:53 PM

well, i've tried some things, even using your exact phrase, and i get:

Code:

find: paths must precede expression
Usage: find [-H] [-L] [-P] [path...] [expression]

hmmm....

homey 07-02-2006 09:43 PM

I was just showing the method of finding more than one file type. :)
This would be a more complete example of what you are doing.
Code:

(cd /home/mp3 ; find . -type f \( -iname "*.mp3" -o \
-iname "*.flac" -o -iname "*.ogg" \) -exec ls {} \;  | \
cut -d/ -f2 > /home/list.txt)


mrclisdue 07-03-2006 03:48 AM

thanx homey....you're my 'hero for a day'


cheers,


All times are GMT -5. The time now is 10:16 AM.