Operating System - HP-UX
1748183 Members
3765 Online
108759 Solutions
New Discussion юеВ

Re: how do i look for a directory which i cant find...

 
bob the spod
Occasional Advisor

how do i look for a directory which i cant find...

Im frantically searching directories within directories to find a directory!

Is there a cmd i can kick off from home to go find it?

I know it exists out there somewhere... What would you suggest?
you make me feel like dancing (gonna dance the night away!)
6 REPLIES 6
Pete Randall
Outstanding Contributor

Re: how do i look for a directory which i cant find...

Use find:

find /dir -type d -name *name*


Pete

Pete
Jeff Schussele
Honored Contributor

Re: how do i look for a directory which i cant find...

Hi Bob,

Yep, use find as follows

find /start_dir -type d -name dir_name

The first dir name (start_dir) is where the top of the search tres will be i.e. nothing above it in the actual dir tree will be searched, but everything below will. If your not 100% sure of the target dir name you can use wildcards as follows

-name "*abc*"

This would find anything containing the string "abc"

Rgds,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
Cheryl Griffin
Honored Contributor

Re: how do i look for a directory which i cant find...

How about find:
# find /home/cherylg -name 234 -print
/home/cherylg/abc/123/234

replace /home/cherylg with the path that you want to start the search from.
replace 234 with the name of the directory you want to find.
"Downtime is a Crime."
Dario_1
Trusted Contributor

Re: how do i look for a directory which i cant find...

Hi!

find / -type d -name dirname -print

Regards,

DR
Cheryl Griffin
Honored Contributor

Re: how do i look for a directory which i cant find...

Dario,
There is usually no need to traverse the system by starting from /. It would be quicker to give it a starting point where you know the directory might be. "find /" should be a last resort.
"Downtime is a Crime."
Dario_1
Trusted Contributor

Re: how do i look for a directory which i cant find...

Cheryl:

I agree with you, but he's searching directory within directory to find a directory. My command will search the entire system avoiding the execution of the command in every mount point.

Regards,

DR