dir command help!

2 views (last 30 days)
Leonardo Wayne
Leonardo Wayne on 17 Mar 2016
Edited: Anand Swaroop on 7 Dec 2021
I am trying to understand the dir command. I am looking section that List the contents of a folder. the syntax is dir my_folder , is my folder in the current directory or it must be a string like'C:\......my 'folder Reference: http://uk.mathworks.com/help/matlab/ref/dir.html?searchHighlight=dir#inputarg_name

Answers (1)

Anand Swaroop
Anand Swaroop on 7 Dec 2021
Edited: Anand Swaroop on 7 Dec 2021
Dir function lists the files and folders in current directory.
The argument ‘my_folder you mentioned should be a directory path, either absolute or relative.
For example, if you are in the path
then following both are valid usages
If you try it from parent directory i.e. C:/demo, you can pass relative path also
You can also pass a variable which contains the valid path
Hope this will be helpful to you
Best Regards
Anand Swaroop
Anand Swaroop
Anand Swaroop on 7 Dec 2021
@Jan correction done. thanks for pointing out.

Sign in to comment.


Find more on File Operations in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!