The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

pathup - find an enclosing directory

SYNOPSIS

pathup name [ start ]

pathup -h

pathup --help

DESCRIPTION

Starting from a directory start (defaults to the current directory), look for the first (i.e., most closely enclosing) ancestor directory with the specified name.

Searching for an ancestor named `.' simply returns the absolute path of the specified directory itself; searching for `..' returns its parent's absolute path.

Searching by an absolute path name returns that same path, unless the path doesn't specify an existing directory.

EXAMPLES

% cd /some/very/very/long/path
% cd `pathup very` && pwd
/some/very/very
% pathup very
/some/very
% pathup foo
Not found: 'foo'

% cd /some/path/somewhere
% pathup .
/some/path/somewhere
% pathup ..
/some/path
% pathup /
/

TO DO

Allow use of multiple-directory names (e.g., `pathup foo/bar`)?

Allow use of a grep pattern instead of a directory name.

VERSION

1.01

COPYRIGHT

Copyright 2003 Paul M. Hoffman. All rights reserved. This program is free software; you can redistribute it and modify it under the same terms as Perl itself.