FDECOMP
Name
FDECOMP
Purpose
Routine to decompose file name(s) for any operating system.
Calling Sequence
FDECOMP, filename, disk, dir, name, qual, [OSFamily = ]
Input
filename - string file name(s), scalar or vector
Outputs
All the output parameters will have the same number of elements as
input filename
disk - disk name, always '' on a Unix machine, scalar or vector string
dir - directory name, scalar or vector string
name - file name, scalar or vector string
qual - qualifier, set equal to the characters beyond the last "."
Optional Input Keyword
OSFamily - scalar string specifying the operating system, must be either
'Windows' or 'unix'. If not supplied,
then !VERSION.OS_FAMILY is used to determine the OS.
Examples
Consider the following file names
unix: file = '/itt/idl71/avg.pro'
Windows: file = 'd:\itt\idl71\avg.pro'
then IDL> FDECOMP, file, disk, dir, name, qual
will return the following
Disk Dir Name Qual
Unix: '' '/itt/idl71/' 'avg' 'pro'
Windows: 'd:' \itt\idl71\ 'avg' 'pro'
Notes
(1) The period is removed between the name and qualifier
(2) Unlike the intrinsic FILE_BASENAME() and FILE_DIRNAME() functions,
one can use FDECOMP to decompose a Windows file name on a Unix machine
or a Unix filename on a Windows machine.
Routines Called
None.
History
version 1 D. Lindler Oct 1986
Include VMS DECNET machine name in disk W. Landsman HSTX Feb. 94
Converted to Mac IDL, I. Freedman HSTX March 1994
Major rewrite to accept vector filenames V5.3 W. Landsman June 2000
Fix cases where disk name not always present W. Landsman Sep. 2000
Make sure version defined for Windows W. Landsman April 2004
Include final delimiter in directory under Windows as advertised
W. Landsman May 2006
Remove VMS support, W. Landsman September 2006
Remove MacOS branch (same as Unix) W. Landsman August 2009