1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
function read_dir(dir,readFiles,readFolders,showExtension) 	local dir_folders={} 	local dir_files={} 	 	if readFiles then 		os.execute('dir /b /a:-d "'..dir..'" > tmp') 		for line in io.lines("tmp") do 			if showExtension then 				table.insert(dir_files,line) 			else				 				local file=string_split(line,"[^.]*") 				local ext=table.remove(name,#name) 				local name=table.concat(file,".") 				table.insert(dir_files,name) 			end 		end 	end 	if readFolders then 		os.execute('dir /b /a:d "'..dir..'" > tmp') 		for line in io.lines("tmp") do 			table.insert(dir_folders,line) 		end 	end 	os.remove("tmp") 	return dir_files,dir_folders end
As you can see, the function throws 'dir /b /a:-d "'..dir..' (files) and 'dir /b /a:d "'..dir..'(directory) to the DOS, but it doesn't work with bash.
I'm not well familiarized with the command "ls", so if someone here is a linux user and wanna help me, I would appreciate it.