Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 03-02-2013, 12:04 AM   #1
LQ Newbie
Registered: Mar 2010
Posts: 20

Rep: Reputation: 0
Search for specific type of file recursively

Greetings to All,
I have a requirement to search a folder recursively for a specific type of file (pdf- for example)and record/throw the name of folders that don't contain the specific type of files inside them. I am unable to achieve the same with my limited knowledge of ls -R Kindly help
Old 03-02-2013, 12:32 AM   #2
LQ Guru
Registered: Dec 2011
Distribution: Slackware, MX 18
Posts: 9,083
Blog Entries: 14

Rep: Reputation: 1117Reputation: 1117Reputation: 1117Reputation: 1117Reputation: 1117Reputation: 1117Reputation: 1117Reputation: 1117Reputation: 1117

And Welcome to Linux Questions!

I think you'll find these few tutorials helpful.

Also; depending in which distribution that you are using you can open the terminal and execute:
man ls
The man pages are helpful.

How to find files in Linux using 'find'

Hope this helps
1 members found this post helpful.
Old 03-02-2013, 01:01 AM   #3
Senior Member
Registered: Jul 2012
Location: Grenoble, Fr.
Distribution: Sun Solaris, RHEL, Ubuntu, Debian 6.0
Posts: 1,800
Blog Entries: 4

Rep: Reputation: 286Reputation: 286Reputation: 286
Try find command (see manual here):
~$ man find

~$ find /path/to/search -name "*.pdf" -print
~$ find /path/to/search -type f -name "*.pdf" -print
1 members found this post helpful.
Old 03-02-2013, 04:07 AM   #4
Senior Member
Registered: Sep 2012
Posts: 1,385

Rep: Reputation: 274Reputation: 274Reputation: 274
In addition to "find" command, you can try "locate"

locate *.pdf
Old 03-02-2013, 04:15 AM   #5
LQ Guru
Registered: Dec 2008
Location: Westgate-on-Sea, Kent, UK
Distribution: Debian Testing Amd64
Posts: 5,465

Rep: Reputation: Disabled
Originally Posted by kooru View Post
In addition to "find" command, you can try "locate"

locate *.pdf
However remember that the locate command requires you to first run (as root or using sudo) the updatedb command
1 members found this post helpful.


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
How to build a script that will search for a specific word in a log file kimbo8 Programming 1 03-27-2012 06:17 AM
Create a file from two files with specific search conditions.(a bit Difficult) Linux - Server 4 05-06-2010 10:18 AM
[SOLVED] how to make grep to search a pattern in only specific file type mq15 Linux - Newbie 7 03-07-2010 10:41 AM
search and replace specific line in the file ablanc Programming 6 11-05-2009 12:06 AM
[SOLVED] search for specific file extension limdel Linux - Newbie 4 06-17-2009 09:06 AM > Forums > Linux Forums > Linux - Newbie

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

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