Skip to content

fileparts

Split a file path into its components.

[pathstr, name, ext] = fileparts(filename)

Decomposes filename into directory path, basename, and extension (including the leading .). The optional fourth output versn is reserved for legacy versioned-filesystem support.

[p, n, e] = fileparts('/data/raw/run_42.csv')
% p='/data/raw', n='run_42', e='.csv'
  • fullfile — Build a file path from directory and file components.
  • filesep — Platform-specific path separator.