About
This is a small little utility program I designed to replace the in-built 'list' program because of two shortcomings; it doesn't show the size of files, and it doesn't show hidden files. Quite a few programs on the forums I've tried recently install hidden files onto your computer but unless you use fs.list explicitly, they're invisible to the user; so you either have to open up a terminal in your real computer and do a purge manually or cumbersomely do it with custom scripts or through the lua interpreter. Both solutions are ridiculous, so I made this tool to make the problem easier to deal with.
The other issue came when I accidentally hit the memory limit on my machine without realizing. fs.getFreeSpace makes it easy to know how much you have left, but knowing what's actually taking up that space is not so easy without, again, an external browser. This tool will report how big every file in the path is, and recursively calculate the total size of folders as well.
lsa on basic usage looks pretty-much identical to a regular ls call, and can be used perfectly safely as a substitute:
Spoiler
But we can use options to see a few hidden files from previous programs lurking on the hard drive. The long-list option also gives us an idea for how much space everything is taking up:
Spoiler
Like the built-in list, we can list multiple files and folders following those options:
Spoiler
Usage
You can download the script here: http://pastebin.com/fWDrjtvL
ls [option]… [path]…
-l: Uses long listing format, including file type and size
-a: List all files, including hidden files. This is equivalent to the -A (almost all) option in unix ls.
-h: Displays usage info
Options can be combined but you shouldn't put options after the path.
Comments
Like the built-in list, the program is reasonably useless unless it's in the system path. I have a dedicated folder for this (and other) utility program and a simple startup script to add them to the path, which is how I recommend you use it.
The biggest issue it has at the moment is it's quite slow when using the -l option; the recursive memory calculation can be slow on a system with a lot of files, and I haven't optimized the program very much. I'll keep toying and possibly make a few changes to get the speed up a bit. There is a tiny delay without the option as well, noticeable if you run them side-by-side.
Please leave comments if you have any questions, or find any issues with the tool. Thank you!