[X-Unix] Finding Parent Directory of Searched-For File

David Ledger dledger at ivdcs.demon.co.uk
Tue May 5 05:51:18 PDT 2009


At 12:53 -0700 4/5/09, Wing Wong wrote:
Hmm... instead of ls, have you considered using 'find'?

To get a similar output to what you have(ls -l information):
find . -ls | grep "Bookmarks.plist"

To just get the files, without the "ls -l " info:
find . | grep "Bookmarks.plist"

If you want to get the full path:
find `pwd` -ls | grep "Bookmarks.plist"
or
find `pwd` | grep "Bookmarks.plist"

Using the full arguments to 'find' as indicated by others is the 
preferred way to do it. The above will work, but it's not good to get 
into the habit of using such inefficient code.

David


-- 
David Ledger - Freelance Unix Sysadmin in the UK.
HP-UX specialist of hpUG technical user group (www.hpug.org.uk)
david.ledger at ivdcs.co.uk
www.ivdcs.co.uk


More information about the X-Unix mailing list