List files

question
#1

Hi,

which command can we use for list files (shell script) in Julia Terminal Windows?

Best!

0 Likes

#2

readdir

2 Likes

#3
 readdir()
8-element Array{String,1}:
 ".gitignore"
 ".travis.yml"
 "docs"
 "LICENSE"
 "README.md"
 "REQUIRE"
 "src"
 "test"

I cannot find the name of folder and more infos.

0 Likes

#4

I recommend you to read https://docs.julialang.org/en/latest/base/file/ part of the Julia manual.

I understand you want something like:

print("Current directory: ", pwd())
foreach(readdir()) do f
       println("\nObject: ", f)
       dump(stat(f)) # you can customize what you want to print
end
3 Likes

#5

You can get the name of the folder you are currently working in with

pwd() 
0 Likes

#6

in ubuntu terminal, if we use “ls” command in a folder , it shows all names of file and sub-folders in this folder.

0 Likes

#7

Run:

run(`ls`)

or

read(`ls`, String)

to fetch the output

0 Likes

#8

src and test are subfolders.

0 Likes