LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
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 03-02-2013, 12:04 AM   #1
koshy
LQ Newbie
 
Registered: Mar 2010
Posts: 17

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
Thanks
Koshy
 
Old 03-02-2013, 12:32 AM   #2
Ztcoracat
Senior Member
 
Registered: Dec 2011
Distribution: Slackware,CentOS & Linux Mint
Posts: 3,405
Blog Entries: 1

Rep: Reputation: Disabled
Hi:

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:
Code:
man ls
The man pages are helpful.

How to find files in Linux using 'find'
http://www.codecoffee.com/tipsforlinux/articles/21.html

http://content.hccfl.edu/pollock/unix/findcmd.htm

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

Rep: Reputation: 285Reputation: 285Reputation: 285
Try find command (see manual here):
Code:
~$ 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
kooru
Senior Member
 
Registered: Sep 2012
Location: Italy
Distribution: Slackware, NetBSD
Posts: 1,369
Blog Entries: 5

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

Code:
locate *.pdf
 
Old 03-02-2013, 04:15 AM   #5
jdkaye
Senior Member
 
Registered: Dec 2008
Location: Westgate-on-Sea, Kent, UK
Distribution: Debian Testing Amd64
Posts: 4,967

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

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


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
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) vysakh@gmail.com 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


All times are GMT -5. The time now is 02:26 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration