Assign File Parsing Functions
Reference: Assign
The Assign command provides several functions for parsing file names. These functions are available only in this command. They assume the name is a standard Windows file name, where folders are separated by backslash characters “\” and the extension is identified by a period “.”. Each function results in a string.
•
GetPath - returns that entire path associated with the file,
including the trailing backslash:
:Assign: f = GetPath c:\temp\output.tmp.txt results in
c:\temp\
•
GetFile - returns the entire file name exclusive of the
path:
:Assign: f = GetFile
c:\temp\output.tmp.txt results in output.tmp.txt
•
GetName - returns the root name of the file without the last
extension, if any. Only that portion of the name following the last
period, and including that period, is
removed:
:Assign: f = GetName
c:\temp\output.tmp.txt results in output.tmp
•
GetExt - returns the trailing extension, if any. Only that
portion of the name following the last period, and excluding that period, is
returned:
:Assign: f = GetExt
c:\temp\output.tmp.txt results in txt
The operand is assumed to be a filename and the output is a string. It is unnecessary to include the file name within quotes.