ls command output format different

canalrun

Well-Known Member
Licensed User
Longtime User
Hello,
I am interfacing with an external program that expects a directory listing in a certain format. I use the following command in B4A to get the output from the shell'ed "ls -l dirname" command.

B4X:
s = "ls -l " & File.DirDefaultExternal
ph.Shell(s, Null, stdout, Null)

The result is in a format that is different from what I have seen documented in examples of the "ls -l" command.

The examples I have seen show something like:
B4X:
-rw-r--r--@ 1 joe root 7608 Apr 1 2006 MYSQL_README

From the B4A shell "ls -l" command I get:
B4X:
-rw-rw-r-- root sdcard 0 2013-03-08 20:49 junk.txt

The external program is not smart enough to deal with the different format. Notice in the B4A output there is no "number of hard links" and the date format is different.

Is this difference part of Android? Is there a way to modify "ls -l" to have it output the directory listing to match the documented format?

Thanks,
Barry.
 

canalrun

Well-Known Member
Licensed User
Longtime User
Hello,
I am interfacing with an external program that expects a directory listing in a certain format. I use the following command in B4A to get the output from the shell'ed "ls -l dirname" command.

After more testing and little success I found the File Handling Library from HotShoe. This includes a method to return a list of files in a directory with all the information. It works very well.

Thanks,
Barry.
 
Upvote 0
Top