LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   find question (https://www.linuxquestions.org/questions/linux-newbie-8/find-question-292759/)

coder22 02-20-2005 06:56 PM

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

homey 02-20-2005 09:40 PM

try this ...
Code:

find /mnt/music  -type f \( -name '*.mp3' -o -name '*.ogg'  \
-o -name '*.wma' -o -name '*.wav' \) -exec ls {} \;


coder22 02-21-2005 06:49 AM

@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

druuna 02-21-2005 07:11 AM

Hi,

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

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

Hope this helps.


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