LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-20-2005, 07:56 PM   #1
coder22
LQ Newbie
 
Registered: Apr 2004
Location: AUSTRIA
Distribution: FC3
Posts: 14

Rep: Reputation: 0
find question


Hi all,

what do I have to type in, when I want to list all
mp3 - ogg - wma - and wav-files with their FULL PATH (/mnt/music/...)
by using the command "find"

[admin@server /]# find . /mnt/music -name "*.mp3 *.ogg *.wma *.wav"

doesn't work. Any help?

coder22
 
Old 02-20-2005, 10:40 PM   #2
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 61
try this ...
Code:
find /mnt/music  -type f \( -name '*.mp3' -o -name '*.ogg'  \
-o -name '*.wma' -o -name '*.wav' \) -exec ls {} \;

Last edited by homey; 02-20-2005 at 11:06 PM.
 
Old 02-21-2005, 07:49 AM   #3
coder22
LQ Newbie
 
Registered: Apr 2004
Location: AUSTRIA
Distribution: FC3
Posts: 14

Original Poster
Rep: Reputation: 0
@homey: Thanks - worked great

But I've got one more question:
By using find in combination with regex, the command for listing all ogg-files is:
Code:
find . -regex '.*\.ogg'
and that works for me. But when I want to have an OR within (to search for oggs and wma-files for example)
it doesn't work, and I tried a lot, but couldn't get it work. This doesn't work:
Code:
find . -regex '.*\.ogg|.*\.wma'
Any ideas?
Thanks in advance,
coder22
 
Old 02-21-2005, 08:11 AM   #4
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Hi,

You need to escape the 'or' sign (pipe). Ie:

find . -regex '.*\.ogg\|.*\.wma'

Hope this helps.
 
  


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Question about FIND katsal Linux - General 4 04-28-2005 05:11 AM
Find question facets Linux - Newbie 3 03-04-2005 08:04 AM
'find' expression question Thorsten Linux - General 3 05-03-2004 08:41 AM
Question on find command rytrom Linux - Newbie 3 08-07-2003 03:14 AM
question on find pfunk Linux - General 4 07-10-2002 06:27 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:25 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration