Is there any (unix) command that can locate a given directory?
So for instance, I have a directory named “MyDir”, but I don’t know its absolute path on disk. Is there any command that I will give the path to MyDir?
More specifically, I’d like to do this in a Java program (via system call).
// return the full path to the specified directory
// if there's more than once directory with the given name
// just return the first one.
static String findPath (String dirName)
{
// CODE here
}
Thanks!
The
locatecommand, if available (some systems may not have building its index enabled), will perform a substring match against the paths of files in all world-readable directories on the system.