Programming > Files and Folders

38 functions in MATLAB › Programming > Files and Folders.

Search Path

addpathAdds folders to the top of the search path.
genpathReturns a path string listing a folder and all of its subfolders.
pathShows or sets the search path.
pathsepReturns the character that separates folders in a path string.
rehashRefreshes the program's cache of the folders on the path.
restoredefaultpathResets the search path to its default folders.
rmpathRemoves folders from the search path.
userpathReturns or sets the user's default working folder.

File Operations

cdShows or changes the current folder.
copyfileCopies a file or a folder.
dirLists the files and folders that match a name or pattern.
existChecks whether a variable, file, folder or function exists, and what kind it is.
fileattribReads the attributes of a file or folder.
isdirTests whether a name is a folder (superseded by isfolder).
isfileTests whether a name is an existing file.
isfolderTests whether a name is an existing folder.
lsLists the names of the files and folders in a folder.
mkdirCreates a folder, including any missing parent folders.
movefileMoves or renames a file or folder.
pwdReturns the current folder.
recycleGets or sets whether deleted files go to the recycle bin.
rmdirRemoves a folder.
whatLists the MATLAB files in a folder, grouped by type.
whichLocates a function, script, file or variable.

File Name Construction

filemarkerReturns the character that separates a file name from a local function name.
filepartsSplits a file path into folder, name and extension.
filesepReturns the file separator of the platform.
fullfileBuilds a file path from folder and file name parts.
matlabrootReturns the folder where the program is installed.
tempdirReturns the folder for temporary files.
tempnameReturns a unique name for a temporary file.
toolboxdirReturns the folder of a toolbox.

File Compression

gunzipDecompresses files compressed with gzip.
gzipCompresses files individually into gzip files.
tarPacks files and folders into a tar archive.
untarExtracts the files of a tar archive.
unzipExtracts the files of a zip archive.
zipCompresses files and folders into a zip archive.