dir

  • dir returns a table with the contents (files and folders) of the working directory.
  • dir(strDir) returns the content of the folder specified by string strDir. The latter can either be an absolute path or a relative path (relative on working directory).
Column Name Description
Name File or folder name
Isfolder 0 if name is a file and 1 it is a folder
Size Size of the file in bytes
mtime Modification date timestamps. Convert with u2mdate

Examples

>> dir#
                Name      IsFolder          Size         mtime 
                   .             1             0             0 
                  ..             1             0             0 
            data.csv             0            43   1.51922e+09
              folder             1             0             0
             myfun.m             0           712    1.5199e+09 
     session2Feb.mat             0             0   1.51998e+09 
>> dir([pwd, '\folder'])#
      Name      IsFolder          Size         mtime 
         .             1             0             0 
        ..             1             0             0 
  myfun2.m             0          1038   1.51929e+09 

Resources

See also

cd | path | pwd