Reference Guide > P Routines > PARSEFILENAME Procedure
  

PARSEFILENAME Procedure
Extracts specified parts of a full file pathname.
Usage
PARSEFILENAME, pathname
Input Parameters
pathname — A string containing a full file pathname.
Keywords
Extension — If set, returns the filename extension (for example, .pro).
Filename — If set, returns a string containing the file root name with its extension (for example, boulder.img).
Fileroot — If set, returns a string containing the filename without its extension.
Path — If set, returns a string containing the full pathname without the filename.
Separator — If set, specifies a single-char string to use as a directory separator. The default separator is platform-specific:
(UNIX) '/'
(WIN) '\'
Discussion
The PARSEFILENAME procedure takes a string containing a path and/or a filename and returns its constituent components (path, filename, file root, and extension) in variables specified using the keywords.
For example, on a UNIX system the file file_mine.pro consists of the file root file_mine and the extension pro.
Example
The following example demonstrates PARSEFILENAME with a UNIX pathname:
full = '/home/work/data/testimage.tif' 
PARSEFILENAME, full, Fileroot=root, $
   Path=path, Filename=name, Extension=extension 
INFO, path, root, name, extension 
; PV-WAVE prints the following:
; PATH        STRING    = '/home/work/data/'
; ROOT        STRING    = 'testimage' 
; NAME        STRING    = 'testimage.tif' 
; EXTENSION   STRING    = 'tif' 
See Also
CHECKFILE  

Version 2017.1
Copyright © 2019, Rogue Wave Software, Inc. All Rights Reserved.