# Is there any function equivalent to "dir" in MATLAB?

**URL:** <https://discourse.julialang.org/t/is-there-any-function-equivalent-to-dir-in-matlab/22217>\
**Category:** General Usage\
**Created:** [March 22, 2019, 9:30pm UTC](https://discourse.julialang.org/t/is-there-any-function-equivalent-to-dir-in-matlab/22217 "2019-03-22T21:30:58Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![abuAnat](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/abuanat/32/23032_2.png) [@abuAnat](https://discourse.julialang.org/u/abuAnat)\
**Post date:** [March 22, 2019, 9:30pm UTC](https://discourse.julialang.org/t/is-there-any-function-equivalent-to-dir-in-matlab/22217/1 "2019-03-22T21:30:58Z")

</div>

Is there any function equivalent to _ **dir** _ in MATLAB; that shows {_name, folder, date, bytes, isdir, datenum_}?

---

<div class="post-metadata">

**Author:** ![aharoun](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/aharoun/32/6887_2.png) [@aharoun](https://discourse.julialang.org/u/aharoun)\
**Post date:** [March 22, 2019, 9:39pm UTC](https://discourse.julialang.org/t/is-there-any-function-equivalent-to-dir-in-matlab/22217/2 "2019-03-22T21:39:53Z")

</div>

You can use the shell mode to execute any system command. Just type semicolon `;`, REPL prompt will change to shell.

---

<div class="post-metadata">

**Author:** ![jmert](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jmert/32/3161_2.png) [@jmert](https://discourse.julialang.org/u/jmert)\
**Post date:** [March 22, 2019, 10:46pm UTC](https://discourse.julialang.org/t/is-there-any-function-equivalent-to-dir-in-matlab/22217/3 "2019-03-22T22:46:11Z")

</div>

I don’t know of anything that comes in the same form, but you can grab a lot of the relevant info with `stat(filename)`, and enumerating the files in a directory can be done with `readdir()`. Putting the two together:

```julia
julia> cd("/usr/bin")

julia> info = Dict(f => stat(f) for f in readdir())
Dict{String,Base.Filesystem.StatStruct} with 2 entries:
  "ld.gold" => StatStruct(mode=0o100755, size=3221912)
  "[" => StatStruct(mode=0o100755, size=55232)
  ⋮ => ⋮

julia> info["ls"].size
137640

```

---

<div class="post-metadata">

**Author:** ![waldyrious](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/waldyrious/32/80_2.png) [@waldyrious](https://discourse.julialang.org/u/waldyrious)\
**Post date:** [March 23, 2019, 4:09pm UTC](https://discourse.julialang.org/t/is-there-any-function-equivalent-to-dir-in-matlab/22217/4 "2019-03-23T16:09:18Z")

</div>

Looks like [MatlabCompat.jl](https://github.com/MatlabCompat/MatlabCompat.jl) would be a good place for this, but unfortunately it doesn’t seem to be actively developed.

---

<div class="post-metadata">

**Author:** ![chakravala](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chakravala/32/6832_2.png) [@chakravala](https://discourse.julialang.org/u/chakravala)\
**Post date:** [March 23, 2019, 6:32pm UTC](https://discourse.julialang.org/t/is-there-any-function-equivalent-to-dir-in-matlab/22217/5 "2019-03-23T18:32:00Z")

</div>

> [@waldyrious](#):
>
> unfortunately it doesn’t seem to be actively developed.

Maybe that’s a good sign, because that means users don’t really need it and are happily transitioning to Julia language
