skip to Main Content

I have access to the server in question. I know the name of the directory I’m looking for on the server, but don’t know the full path to it.

Is there a way for me to retrieve the full file path to the directory by using the the directory name?

Edit: I don’t have shell access.

2

Answers


  1. if you have shell access you can use find like the following

    find / -type d -name DIRECTORYNAME
    

    where / is the search starting point and replace DIRECTORYNAME obviously, also try man 1 find for more information.

    Login or Signup to reply.
  2. You can use locate command

    locate DirectoryName

    Its format is something like this

    locate [option] [search-pattern]

    Note: In the command below, the option –basename or -b tells locate to only match the file (directory) basename (which is exactly pkg) but not the path (/path/to/pkg). Where is a globbing character, it disables the implicit replacement of pkg by pkg.

    locate --basename 'pkg'
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search