Welcome to the Harris Geospatial documentation center. Here you will find reference guides and help documents.


  >  Docs Center  >  Libraries  >  Markwardt  >  RELPATH

RELPATH

RELPATH

Name


  RELPATH

Author


  Craig B. Markwardt, NASA/GSFC Code 662, Greenbelt, MD 20770
  craigm@lheamail.gsfc.nasa.gov
  UPDATED VERSIONs can be found on my WEB PAGE:
      http://cow.physics.wisc.edu/~craigm/idl/idl.html

Purpose


  Construct a relative path between two absolute paths

Major Topics


  Files, I/O

Calling Sequence


  RELPATH, FROM, [/FILE1,] TO, [/FILE2,] RELPATH, [CURRENT=, /INVERT]

Description



  RELPATH constructs a relative path between two absolute paths.
  That is, given two file name paths FROM and TO, RELPATH finds the
  relative path which starts from the current directory of FROM and
  ends in the directory of TO.
  Note that the /FILE1 or /FILE2 keywords can be used to say whether
  FROM or TO, respectively, is a file instead of a directory. This
  is important because RELPATH finds the relative paths between two
  directories, and so the file components are ignored for those
  purposes.
  The INVERT keyword is allows one to invert the path: to find the
  path from the current directory of TO, to the directory of FROM.
  If the user specifies the CURRENT keyword, then relative paths are
  assumed to originate in the CURRENT directory. Otherwise the
  actual current directory is used.
  NORMPATH should be platform independent. Note that the paths do
  not necessarily need to exist on the file system.

Inputs



  FROM - scalar string, gives path of starting point (file or
          directory).
  TO - scalar string, gives path of ending point (file or
        directory).
  RELPATH - upon return, the relative path from FROM to TO.

Keywords



  CURRENT - if specified, must be a scalar string which gives the
            path to the current directory used in forming the
            normalized path. If not specified, then the actual
            current directory is used.
  INVERT - invert the direction of the relative path, i.e. from TO
            to FROM.

Examples



  RELPATH, '/x/y/z', '/x/u/v', relpath & print, relpath
    '../../u/v'
  The two paths share a common root in /x. Therefore, to get to
  /x/u/v from /x/y/z, one must go up two directory levels and then
  down into u/v.

Modification History


  Written and documented, 12 Mar 2004 CM
  Replaced call to STRCAT with STRJOIN, 09 Aug 2006 CM
  Usage message, 23 Mar 2008 CM
  $Id: relpath.pro,v 1.3 2008/03/23 18:14:57 craigm Exp $



© 2019 Harris Geospatial Solutions, Inc. |  Legal
My Account    |    Store    |    Contact Us