It is perhaps easier to lay out your Virtual File System (VFS) so that you have file system mounts in separate directories, but you might wish to mount multiple file systems into a single virtual directory.
This article aims to explain some things to watch out for and what the expected behaviours are if you wish to do this.
We will not cover the actual mounting of file systems here, please refer to this YouTube tutorial video for that.
For the examples in this article, we will have a Windows File Share and an FTP server both mounted at the root virtual folder. The above image shows a snapshot from a windows machine of the file structure of both resources.
Here is the File Resources configuration view in Hypersocket after mounting both file systems.
How are duplicate files handled?
When multiple mounts are defined this way, it is possible that there could be conflicting filenames.
Looking at the image at the top of this article you will note that both file systems here have a file called Document.txt, but when we look at the user's file view in Hypersocket, we see only one document.
Hypersocket will only show the first filename that is declared by a mount and will ignore any conflicting names (this alone is a good argument for mounting file systems into separate virtual directories).
In this case, if we download the Document.txt file and open it, it contains information from the file held on the Windows share, so the Windows file share declared that file first.
How does uploading files into the top level directory work?
So what happens if users want to upload files to the root folder? Which file system do files get created in?
In the File Resources admin UI, select the root virtual folder and look at the right hand side. The first mount you create should automatically get set as the Default Mount. In our case here, this was Windows - hence uploading a file to root will place the files on the Windows share.
Note that if the Default Mount setting is <No Default> then the root directory will be set to read only.
Where do files get created elsewhere in the VFS?
This is much more straightforward. Let's take the example of the Demo and files directories. Demo exists only on the Windows share and files only exists on the FTP server.
As the server knows which mount each directory is from, any file uploads will automatically be placed into the appropriate file systems.