Create object of Linux file system
I would like to create an object which mirrors a Linux file system. Doesn't need to be very complicated, doesn't need file permissions, etc, but just lists the files with KB size and directors under each directory. I then will want to be able to add/delete/rename files and directories in the object.
I was thinking of something like that listed below. Problem with this approach is it doesn't prevent duplicate file names or directory names under a given directory (really not a huge deal). Also, it is somewhat convoluted to select a given directory (some sort of loop through each directory to see if a sub-directory exists, and then inspect that directory).
So, then I thought maybe I should make each folder a property so that duplicates are not possible and selecting a directory is as easy as folder1.dir2.dir22. Problem is one cannot create a directory called "files" as it will conflict with the files array.
Hopefully, what I am attempting to communicate makes sense! Any suggestions on how best to proceed?