Anyone aware of a method/class/library that will allow me to easily reproduce the results of the *nix ls -l command in Java? Calling ls directly is not an option due to platform independence.
eg. $ls -l myprogram.exe
-rwxrwxrwx 1 auser None 1261568 Nov 15 17:41 C:\myprogram.exe
This provides what you are looking for:
I think we don't have ready to use Java class in java stadard library. But you can develop a tool like *nix ls -l tool by using classes in java.io package.
Here's an implementation of
ls -R ~
, which lists files recursively starting in the home directory:Here is a tutorial on getting a directory listing in java with sample source code.
You can use the
java.nio.file
package.