I need to get the folder contents in one command line, right now if I do stat or ls, it tells me file type is Symbolic Link but it doesn't tell me if it's a file or a folder.
I'm using this;
stat -c '{"name": "%n", "size": "%s", "perms":"%a","type":"%F","user":"%U", "dereference","%N"}' /*;
Important point is, i need a one liner and very speedy output. I couldn't get around this doing ls, maybe there is a solution using find, locate etc. Or if u know how to read from mlocatedb ?
Thanks,
Best Answer
Try this which adds another field:
By the way, I changed the comma after "dereference" to a colon.