filename()

Read(3598) Label: split up, full path, get file name, suffix,

Description:

Split up the full path and get the file name and extension.

Syntax:

filename(fn)

Note:

The function splits the file name and extension from the full path fn.

Parameter:

fn

The full path with the file name

Option:

@e

Only split the extension part from the full path

@n

Split out the file name without the extension

@d

Split out the directory under which the file is located, inclusive of address string

@p

Add the main path before the file name of the non-absolute path. Return the main path directly if fn is ""; if the main directory is empty, make the query according to the rules defined in sectionUser reference – Main directroyand return result

@s

Get name of the current script file

Example:

 

A

 

1

=filename("D://file/test.dfx")

Output “test.dfx” .

2

=filename@e("D://file/test.dfx")

Output “dfx”.

3

=filename@n("D://file/test.dfx")

Output “test”.

4

=filename@d("D://file/test.dfx")

Output “D://file”.

5

=filename@p("p2.txt")

Output

“D:\Program Files\raqsoft\esProc\demo\p2.txt”.

6

=filename@p("")

Output the main directory

“D:\Program Files\raqsoft\esProc\demo”.

 

Suppose the current script file is D:\file\p1.splx:

 

A

 

1

=filename@s()

Get name of the current script file and return p1.splx.

2

=filename@sd()

Get the directory containing the current script file and return D:\file.

3

=filename@sn()

Get name of the current script file without extension and return p1.

4

=filename@se()

Get extension of name of the current script file and return splx.

5

=filename@sp()

Get path of the current script file and return D:\file\ p1.splx.

Related function:

file()