Dropbox and its “Folder” like design

2019-07-11 08:19发布

I was wondering from a programmers perspective preferably in C# or Java, how hard is it to manipulate a folder within the operating system to do what you want, for instance to act like an FTP?

image http://www.jacks-log.de/wp-content/uploads/2011/02/Dropbox-Wurmloch-1.png

Since I heard of dropbox a few years ago, I've always been wondering whats involved in doing this?

1条回答
We Are One
2楼-- · 2019-07-11 09:03

Talking about Dropbox in particular, they don't do anything tricky - just a regular folder being monitored using the mechanisms provided by Windows user-mode API.

It is possible to do much more powerful and interesting things using kernel-mode drivers, though.

First thing you can do is create a virtual disk and map it to the folder. This way your code (either kernel-mode or user-mode with help of our products) will be able to handle all OS requests coming for files in this folder. The folder won't exist on the disk but will be virtual. You can pick data from the remote server on the fly, write them to the remote server etc. In particular, you can map a remote SFTP server to the folder (with FTP things are a bit more complicated as FTP doesn't support partial uploads). Some cloud providers do exactly what I described - they offer a virtual disk or a virtual folder which is a "gate" to their cloud service, and when you read or write data from such virtual folder or disk, data goes from/to the cloud server.

Next thing is that with help of the filesystem filter driver you can have a real folder but provide file contents dynamically. This is how some folder encryptors do (they encrypt file data when writing it to the real disk and without this encryptor active you will read just encrypted "junk" from files in this folder).

Now, with filesystem filter driver you can control who and how can access the folder, i.e. you get fine-grain control over access to folder contents (combine this with encryption and you get a handy data protection mechanism).

查看更多
登录 后发表回答