Find full path to specified files
Note: No space is allowed between the option flag and the associated arguments.
which reports the paths to the files given on the command line. We look for the file in (1) the current directory, (2) in $GMT_USERDIR (if defined), (3) in $GMT_DATADIR (if defined), or (4) in $GMT_CACHEDIR (if defined). If found we print the path name to the file, just the directory (see -D), or a confirmation (see -C). The $GMT_USERDIR and $GMT_DATADIR environment variables can be comma-separated list of directories, and we search recursively down any directory that ends with / (i.e., /export/data is a single directory whereas /export/data/ will be searched recursively.) If the file is in the current directory then we just return the relative path (i.e., the file name); otherwise we return the full path.
- One or more file names of any data type (grids, tables, etc.).
- Only consider files that the user has permission to read [Default consider all files found].
- Instead of reporting the paths, print the confirmation Y if the file is found and N if it is not.
- Instead of reporting the paths, print the directories that contains the files.
- If a file argument is a downloadable file (either a complete URL, a @file for downloading from the GMT Site Cache, or @earth_relief_*.grd) we will try to download the file if it is not found in your local data or cache dirs. By default [-Gl] we download to the current directory. Append c to place in the user cache directory or u user data directory instead.
- -V[level] (more …)
- Select verbosity level [c].
- -^ or just -
- Print a short message about the syntax of the command, then exits (NOTE: on Windows just use -).
- -+ or just +
- Print an extensive usage (help) message, including the explanation of any module-specific option (but not the GMT common options), then exits.
- -? or no arguments
- Print a complete usage (help) message, including the explanation of all options, then exits.
- Temporarily override a GMT default setting; repeatable. See gmt.conf for parameters.
Note: Below are some examples of valid syntax for this module.
The examples that use remote files (file names starting with
can be cut and pasted into your terminal for testing.
Other commands requiring input files are just dummy examples of the types
of uses that are common but cannot be run verbatim as written.
To see the path to the file myjunk.txt, use
gmt which myjunk.txt
To download the 10 arc-minute global relief file from the GMT data site, use
gmt which -Gu @earth_relief_10m.grd
which will print the path (after downloading if not already present). The file will be placed in the user’s GMT_USER_DIR. To obtain a GMT example or test file from the GMT cache site, try
gmt which -Gc @hotspots.txt
which will print the path (after downloading if not already present). The file will be placed in the user’s GMT_CACHE_DIR directory.