I have a file server located at say http://myshare.com. This server is used to just host all my files. My file server has a directory named 'myfiles'. So my URI looks something like this: 'http://myshare.com/myfiles'. This location has say 10 files.
First question: How do I get the names of all the files located on this remote file server using Node.js?
Second question: If 'myfiles' directory has sub-directories, how do I traverse all the sub-directories and list all the files in them using Node.js?
Any help would be appreciated. Thanks
I suppose that the files are on the same machine, since you can always mount them with cifs or similar and then it would be the same than local files, making live easier since is OS who manages them instead of your code.
First, you have to familiarize with node's file object anf the function "readdir" either on its async or sync version. http://nodejs.org/api/fs.html#fs_fs_readdir_path_callback
Then you parse the array of files returned .
For subdirectories you have to code a recursive function that calls itself on every directory. For every file you have to check the fsstats and check the property isDirectory() over the returned object.
As a sample, you can check this answer http://stackoverflow.com/a/5827895/1680125
Hope it helps