LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 07-02-2006, 07:20 PM   #1
mrclisdue
Senior Member
 
Registered: Dec 2005
Distribution: Slackware -current, 14.1
Posts: 1,039

Rep: Reputation: 163Reputation: 163
Unhappy 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,
 
Old 07-02-2006, 07:39 PM   #2
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 56
Here's an example from my backup script.
Code:
find /mnt/backup -type f \( -name '*.gz' -o -name '*.log' \) \
-mtime +90 -exec rm {} \;
 
Old 07-02-2006, 08:53 PM   #3
mrclisdue
Senior Member
 
Registered: Dec 2005
Distribution: Slackware -current, 14.1
Posts: 1,039

Original Poster
Rep: Reputation: 163Reputation: 163
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....
 
Old 07-02-2006, 09:43 PM   #4
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 56
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)
 
Old 07-03-2006, 03:48 AM   #5
mrclisdue
Senior Member
 
Registered: Dec 2005
Distribution: Slackware -current, 14.1
Posts: 1,039

Original Poster
Rep: Reputation: 163Reputation: 163
thanx homey....you're my 'hero for a day'


cheers,
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Find and replace text in multiple file Bad_Bob Linux - Software 9 05-08-2008 02:31 AM
using multiple -exec commands in a single find command? Bluemilk Linux - Newbie 4 03-19-2006 10:46 AM
Compiling multiple .c file using single command in makefile vipulc Linux - General 2 03-18-2006 11:49 PM
Issues with multiple data types (C/C++) R00ts Programming 2 11-16-2005 08:37 PM
Command to find out which package contains which file ? javeree Slackware 6 07-10-2004 06:35 PM


All times are GMT -5. The time now is 04:24 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration