- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: how to use `find´ without searching in subdire...
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
11-15-2005 10:46 PM
11-15-2005 10:46 PM
how to use `find´ without searching in subdirectories
I want to find files in a directory, without searching in subdirectories. The subdirectories are on the same volume.
Find /tmp –type f –exec ls {} \; set temp_var = áwk ´{print $1}´´
I have made some Trials with the option –prune and –depth, but this was not successful. I hope you can help me.
Thank you
Rudiger
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2005 10:53 PM
11-15-2005 10:53 PM
Re: how to use `find´ without searching in subdirectories
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2005 10:53 PM
11-15-2005 10:53 PM
Re: how to use `find´ without searching in subdirectories
you can use the find command with following option to exclude directories;
find . -name $DIRNAME -prune -o -print
where, $DIRNAME is the name of the directory to be excluded.
To Exclude multiple directories
find / -type d \( -name DIR1 -o -name DIR2 -o -name DIR3 \) -prune -o -type d -print
HTH,
Prabu.S
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2005 11:16 PM
11-15-2005 11:16 PM
Re: how to use `find´ without searching in subdirectories
other prune examples:
one sub-dir
# find /etc/* -prune -type f -name "T*"
/etc/TIMEZONE
/etc/TIVGUID
two sub-dirs
# find /etc/*/* -prune -type f -name "T*"
/etc/zoneinfo/Turkey
three sub-dirs
# find /etc/*/*/* -prune -type f -name "T*"
/etc/zoneinfo/Australia/Tasmania
regards,
John K.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2005 01:41 AM
11-16-2005 01:41 AM
Re: how to use `find´ without searching in subdirectories
find /tmp -type f -path "./*" -prune -exec ls {} \;
or if you get the gnu version of find at
http://hpux.cs.utah.edu/hppd/hpux/Gnu/findutils-4.2.23/
then you could do-
find /tmp -type f -maxdepth 1 exec ls {} \;
HTH
--Rod Hills
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2005 01:46 AM
11-16-2005 01:46 AM
Re: how to use `find´ without searching in subdirectories
find /tmp -type f -path "/tmp/*" -prune -exec ls -l {} \;
-- Rod Hills
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2005 04:41 AM
11-16-2005 04:41 AM
Re: how to use `find´ without searching in subdirectories
find /tmp -type f -path "/tmp/*" -prune -exec ls -l {} \;
will not skip subdirectories.
I have now tested the command
find /tmp -type f ! -path "/tmp/*/*" -exec ls -l {} \;
and it is working well
Thanks to all for your help
Rudiger
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2005 05:51 AM
11-16-2005 05:51 AM
Re: how to use `find´ without searching in subdirectories
find /tmp -path "/tmp/*" -prune -type f -exec ls -l {} \;
HTH
-- Rod Hills