- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: find command to find directories and sym links...
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
08-18-2008 01:39 AM
08-18-2008 01:39 AM
find command to find directories and sym links to directories
For HPUX how should I use the find command to look for
1) Directories
and
2) Symbolic links to directories. Sym links to files I do not want
In Linux I use
find
but xtype does not work in HPUX
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-18-2008 02:26 AM
08-18-2008 02:26 AM
Re: find command to find directories and sym links to directories
the man page is pretty helpful here.
find
| xargs 555
Finds all files actually files permissions 555.
HP-UX man pages are actually a little better than Linux man pages, IMO
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-18-2008 04:23 AM
08-18-2008 04:23 AM
Re: find command to find directories and sym links to directories
The standard HP-UX 'find' can easily be used for finding directories (question-1):
# find /path -type d -print
To find symbolic links to directories, but not symbolic links to files, I'd use Perl:
# perl -MFile::Find -MCwd=realpath -le 'find(sub{print $File::Find::name if -l $_ && -d realpath($_)},@ARGV)' /path
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-18-2008 04:38 AM
08-18-2008 04:38 AM
Re: find command to find directories and sym links to directories
find path -type d
>2) Symbolic links to directories.
This requires two steps in the shell:
find path -type l -exec check_sym_link +
Then write the check_sym_link script:
for file in "$@"; do
ll -Ld $file | grep -q "^d" && echo $file
done
(I'm not sure if [ -d $file ] would work too?)
>SEP: find
You mean:
find
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-18-2008 06:26 AM
08-18-2008 06:26 AM
Re: find command to find directories and sym links to directories
> find
> but xtype does not work in HPUX
If you really like the "find" in GNU/Linux,
you could try (building and) using that
"find" on HP-UX. The source code is
available:
http://www.gnu.org/software/findutils/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-18-2008 06:32 AM
08-18-2008 06:32 AM
Re: find command to find directories and sym links to directories
find /path -type d -name " " ...
For Link
find /path -type l -name " " ....
HP-UX find is equally stronger!!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-18-2008 06:58 AM
08-18-2008 06:58 AM
Re: find command to find directories and sym links to directories
>
> find /path -type l -name " " ....
I must be missing something. Can you
demonstrate that this works? (Why
'-name " " ....'? What's "...."?)
> 2) Symbolic links to directories. Sym
> links to files I do not want
You did read this, right?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-19-2008 01:03 AM
08-19-2008 01:03 AM
Re: find command to find directories and sym links to directories
You are confusing "stronger" with the saying: standard is better than better. :-)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-19-2008 01:12 AM
08-19-2008 01:12 AM
Re: find command to find directories and sym links to directories
Yes that works:
for file in "$@"; do
[ -d "$file" ] && echo "$file"
done
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-19-2008 06:39 PM
08-19-2008 06:39 PM
Re: find command to find directories and sym links to directories
I manage to find a single line solution
# find
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-19-2008 11:53 PM
08-19-2008 11:53 PM
Re: find command to find directories and sym links to directories
find /var/tmp -follow -type d -exec ll -d {} +|grep ^l
Rgds.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-20-2008 12:10 AM
08-20-2008 12:10 AM
Re: find command to find directories and sym links to directories
Clever. Except if the symlink points to some gigantic directory tree that you don't want to scan, you'll waste time there.