dir
R2026bList folder contents
Syntax
Description
dir lists files and folders in the current
folder.
Examples
Input Arguments
Output Arguments
Limitations
MATLAB does not support internet URLs that require authentication.
MATLAB Online™ supports internet URLs associated with Microsoft OneDrive™ files and folders, while the installed version of MATLAB supports only local OneDrive files.
Tips
If
dircannot query a file, it returns these default values in the output structure.date: '' bytes: [] isdir: 0 datenum: []
This issue most commonly occurs when querying a symbolic link pointing to a moved, removed, or renamed target. To exclude these invalid entries, you can convert the structure to a table and remove the rows with empty values.
listing = struct2table(dir); listing(isempty(listing.bytes),:) = [];
To obtain a list of available drives on Microsoft Windows platforms, use the DOS
net usecommand.dos("net use")