- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- find command - finding a file type in all subdirec...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2005 11:07 PM
03-03-2005 11:07 PM
May I know how I could specify the "find" command to search for a specific file type in a dir and also all its subdirectories?
I tried:
find . -depth -type f -name ".html" -print
or by specifying the absolute path with the preceeding / before "-type" :
find /opt/IBM/WebSphere/Express51/A
ppServer/installedApps/DefaultNode/iscapuat.ear/iscap.war.cj/ -type f -name ".jsp" -print
and also:
find ./ -depth -type f -name ".html" -print
However, both of these commands did not display the files.
Could anyone help me out?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2005 11:11 PM
03-03-2005 11:11 PM
Re: find command - finding a file type in all subdirectories
# find . -depth -type f -name "*.html" -print
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2005 11:39 PM
03-03-2005 11:39 PM
Re: find command - finding a file type in all subdirectories
Hi
Maybe better using ' (not expanded by the shell)
find . -type f -name '*.html'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2005 11:42 PM
03-03-2005 11:42 PM
Re: find command - finding a file type in all subdirectories
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2005 11:56 PM
03-03-2005 11:56 PM
Re: find command - finding a file type in all subdirectories
In a pinch, you can always do this:
cd
find . -type f | grep html
or use grep's multi-pattern capability:
find . -type f | grep -e .html -e .jsp
Note that -depth and -print are defaulted to true so -print and -depth are redundant. If you need to stay at the current directory level (and not go down into other directories), use -prune. Note that when -depth is explicity set on the command line, -prune is disabled. -print is always true unless the output of find is directed to something like -exec, in which case you can add -print to feed the names to exec *and* see the names on stdout at the same time.
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2005 03:02 AM
03-06-2005 03:02 AM
Re: find command - finding a file type in all subdirectories
Thanks for taking the effort in posting solutions to my question. I've tried all of the methods suggested in the earlier 3 replies to my question - however, none of these commands would search for the specified files (.html and .jsp) in the subdirectory beneath the current directory. In fact, I had tried the method #find . -depth -type f -name "*.html" as suggested by Stephen Keane before receiving replies to my question - it still could not retrieve the files from the subdirectories in the current sub-dir.
Greatly appreciate it if anyone could provide other ideas/suggestions to this issue.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2005 05:10 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2005 06:55 AM
03-06-2005 06:55 AM
Re: find command - finding a file type in all subdirectories
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2005 12:15 PM
03-07-2005 12:15 PM
Re: find command - finding a file type in all subdirectories
The command below worked.
# find
Thanks to everybody for helping out in this question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2005 12:18 PM
03-07-2005 12:18 PM