Skip to content

File Functions#

File functions in Spectrum allow you to work with file paths, these functions can help find a files name, type (extension), or root directory.

The following are the file functions in Spectrum:

FILE_BASE#

Syntax#

FILE_BASE(<string>)

Description#

Returns the non-directory portion of a file path.

Examples
Column1 FILE_BASE returns
/dir1/dir2 dir2
/dir1/file.txt file
/file.txt file
C:\dir1\dir2 dir2
C:\dir1\file.txt file
C:\file.txt file
file.txt file
/dir1/dir2/ λ (= an empty string)

FILE_FULL_PATH#

Syntax#

FILE_FULL_PATH(<string>)

Description#

Returns the entire file path (including the root directory) without the filename and extension.

Examples
Column1 FILE_FULL_PATH returns
/dir1/dir2 /dir1/
/dir1/file.txt /dir1/
/file.txt /
C:\dir1\dir2 C:\dir1\
C:\dir1\file.txt C:\dir1\
C:\file.txt C:\
file.txt λ (= an empty string)

FILE_NAME#

Syntax#

FILE_NAME(<string>)

Description#

Returns only the filename and extension.

Examples
Column1 FILE_NAME returns
/dir1/dir2 dir2
/dir1/file.txt file.txt
/file.txt file.txt
C:\dir1\dir2 dir2
C:\dir1\file.txt file.txt
C:\file.txt file.txt
/dir1/dir2/ λ (= an empty string)
C:\dir1\dir2\ λ

FILE_PATH#

Syntax#

FILE_PATH(<string>)

Description#

Returns the file path excluding the root directory and the file name.

Examples
Column1 FILE_PATH returns
/dir1/dir2 dir1/
/dir1/file.txt dir1/
/file.txt λ (= an empty string)
C:\dir1\dir2 dir1\
C:\dir1\file.txt dir1\
C:\file.txt λ
file.txt λ

FILE_ROOT#

Syntax#

FILE_ROOT(<string>)

Description#

Returns the root directory of a file path.

Examples
Column1 FILE_ROOT returns
/dir1/dir2 /
/dir1/file.txt /
C:\dir1\dir2 C:\
C:\dir1\file.txt C:\
file.txt λ (= an empty string)

FILE_TYPE#

Syntax#

FILE_TYPE(<string>)

Description#

Returns the file extension of a file path.

Examples
Column1 FILE_TYPE returns
/dir1/file.txt txt
/file.txt txt
C:\dir1\file.tx txt
C:\file.txt txt
file.txt txt
/dir1/dir2 λ (= an empty string)
/dir1/dir2/ λ
C:\dir1\dir2 λ