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

#1

Is there any function equivalent to dir in MATLAB; that shows {name, folder, date, bytes, isdir, datenum}?

0 Likes

#2

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

1 Like

#3

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> 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
1 Like

#4

Looks like MatlabCompat.jl would be a good place for this, but unfortunately it doesn’t seem to be actively developed.

0 Likes

#5

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

4 Likes