Page 1 of 1

Folder structure in ES3Cloud

Posted: Fri Aug 09, 2019 9:04 pm
by Joel
Status

Complexity

5/10

Description

This request is for a folder structure in ES3Cloud. This would allow people to upload using a path, which would then allow them to download all files in a given folder.

One way to achieve this would be to split the filename from the path, and then store the path (minus the filename) in a path column in the database.

As this would require changes to the MySQL database, care should be taken to ensure that it is backward compatible with previous versions.

Re: Folder structure in ES3Cloud

Posted: Mon Aug 12, 2019 8:39 am
by krolldk
I thought a little bit more about it, and maybe the feature is a bit harder than I originally thought....
e.g. nested folders would be tricky...

ES3File myFile = new ES3File("dir1/dir2/dir3/filename.es3") would, with my suggestion, be saved in the DB as :
dir1/dir2/dir3/ in the path field, and "filename.es3" in the filename field.
You could still have a GetFiles("dir1/dir2/dir3/") command, and return filename.es3, but what if I ask:
GetFiles("dir1/dir2") ? I would, as a dev, expect to get something like "dir3/" returned, because that directory conceptually exists in my filestructure, but that would be hard to implement in a sane and efficient manner.

So: Maybe you want to keep the current DB structure, and instead support regexp in a new function: e.g. GetFilesRegExp(string regexp). If I do e.g. GetFilesRegExp("dir1/*") I get all files with filename starting with "dir1/" returned.

This will NOT require a database change, and probably be easier and more efficient to implement in the php script ?

Re: Folder structure in ES3Cloud

Posted: Mon Aug 12, 2019 6:06 pm
by Joel
Thanks for the suggestion, much appreciated. The ideal solution would likely be a mix of both of these.

The public API would be accessed through a method call such as (this code is simplified):
var ES3Cloud = new ES3Cloud("https://www.site.com/ES3Cloud.php");
yield return StartCoroutine(cloud.DownloadFiles("/dir/myDir/", "user", "pass"));
// Plus an equivalent method to download ES3Files.
And underneath, it uses MySQLs Regex to get these files. This would keep the API accessible, while also giving us the flexibility of Regex, and backwards compatibility with the current MySQL table :)

All the best,
Joel

Re: Folder structure in ES3Cloud

Posted: Mon Aug 12, 2019 7:09 pm
by krolldk
Yeah. That makes sense. Not everyone can use regexp I suppose. Would it be too much to ask for ALSO the regexp thing for those of us that do speak regexp ? I mean, that would make it pretty powerful for us, allowing us to do stuff like:
yield return StartCoroutine(cloud.DownloadFilesRegexp("/dir/myDir/*.foo", "user", "pass")); to download all files in directory dir/ with fileextension .foo. And very little extra work for you....

Re: Folder structure in ES3Cloud

Posted: Mon Aug 12, 2019 7:52 pm
by Joel
Would be a no-brainer from my perspective, so that would definitely be included at the same time.

All the best,
Joel