Get Node installed, and write a Javascript script that does the following:
[x] Reads the contents of the current directory, recursively descending into subdirectories.
[x] Creates an array listing all files along the way, more specifically their full path names relative to the current directory and file sizes. Ensure that pathnames are computed in a system-independent way (Path module helps here)
[x] Creates a new temporary json file, and writes a JSON representation of this information into that file. Ensures that the path to that file is communicated to standard output or error.
[x] Computes the total file size.
[ ] Optionally, computes the sizes of all files within a subdirectory.
[x] Adds this information appropriately into the JSON file.
[x] Logs some diagnostic information to standard error.
[x] Exits the process with a proper code
[x] Gracefully handles errors occuring during the process, and logs information to the standard error before exiting with appropriate code. Examples of errors: The current directory or a subdirectory might not be readable because of permissions; attempts to create a temporary file might fail.
Get Node installed, and write a Javascript script that does the following:
Useful Node modules (found in http://nodejs.org/api): File, Path, OS, Process Reference for JSON: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON