Parse Filename

The Parse Filename command gets the directory, filename and extension from the specified filename. The script does not check if the specified file exists. Also, the operation of the script depends on the operating system. For example, the command will not determine the directory for c:\my folder\myfile.txt on Linux.

Filename
Specify the name of the file you want to parse.

Variable name
Specify a variable name where the directory, file name and extension will be written. This variable is an object that contains the following fields:

  • dir - directory;
  • filename - filename without path;
  • ext - extension of the file;
  • fileonly - file name without path or extension.

For example, if you specified the variable name fi and the file name is C:\Data\my folder\mydata.txt, then after calling the script, the output of this text to the console

1Dir = #fi.dir#
2Filename = #fi.filename#
3Ext = #fi.ext#
4Fileonly = #fi.fileonly#

will give the following result

1Dir = C:\Data\my folder
2Filename = mydata.txt
3Ext = txt
4Fileonly = mydata

In addition, an ordinary variable will be created with a name equal to Variable Name, which is equal to the Filename parameter.

Online Demo
Downloads Documentation Scripts Support
English
Русский