fileparts: MATLAB fileparts function

View source: R/fileparts.R

filepartsR Documentation

MATLAB fileparts function

Description

Return filename parts.

Usage

fileparts(pathname)

Arguments

pathname

character string representing pathname to be parsed

Details

Determines the path, filename, extension, and version for the specified file. The returned ext contains a dot (.) before the file extension. The returned versn is always an empty string as the field is provided for compatibility with its namesake's results.

Value

Returns a list with components:

pathstr

character string representing directory path

name

character string representing base of file name

ext

character string representing file extension

versn

character string representing version. Unused

Note

Returns same insane results as does its namesake when handling relative directories, UNIX hidden files, and tilde expansion. Hidden files are returned with name containing a zero length vector and ext containing the actual name. For best results, use this routine to process files, not directories.

Author(s)

P. Roebuck proebuck1701@gmail.com

See Also

fullfile

Examples

## Rename dot-txt file as dot-csv
ans <- fileparts("/home/luser/foo.txt")
fullfile(ans$pathstr, paste(ans$name, "csv", sep="."))   # /home/luser/foo.csv

matlab documentation built on June 2, 2022, 1:09 a.m.