<< dir Files and folders functions filesep >>

fileparts


Returns the path, filename and extension of a file path.


Syntax


[p, f, e] = fileparts(fullpath)
p = fileparts(fullpath, 'path')
f = fileparts(fullpath, 'filename')
e = fileparts(fullpath, 'extension')

Input argument


fullpath

a string: file or directory name.

Output argument


p

a string: path of the directory fullpath.

f

a string: file name without extension of fullpath.

e

a string: extension name of fullpath.

Description


[p ,f, e] = fileparts(fullpath) splits in its three parts: path, filename, extension including the dot.

Example


[p, f, e] = fileparts([nelsonroot(), '/etc/finish.m'])
p = fileparts([nelsonroot(), '/etc/finish.m'], 'path')
f = fileparts([nelsonroot(), '/etc/finish.m'], 'filename')
e = fileparts([nelsonroot(), '/etc/finish.m'], 'extension')

See also


isdir, isfile, pathsep, filesep.

History


Version Description
1.0.0 initial version

Author


Allan CORNET

<< dir Files and folders functions filesep >>