Is it possible to determine the amount of free space on a remote FTP server without using scripts?

为君一笑 提交于 2019-12-08 07:39:40

问题


So, here is the setup I have to work with:

I have five servers total in different locations. One server is purely a web server for hosting static files. The other four servers are solely FTP servers, each containing files uploaded by users through PHP scripts.

What I want to do is be able to choose the server with the most free space available and send the next user-uploaded file to it. I've searched around, and there doesn't seem to be any way to do that with only FTP commands.

I found a question about Determining the Free Space of an FTP Server, which showed that it was possible to create and update a file periodically with a Linux Shell script, but, the servers I have are and will stay Windows machines.

My only solution would be to host web servers on the FTP servers with a simple index.php containing the remaining filesize determined by disk_free_space() but that seems a bit much for something so simple.

All that I'm looking for is a way to find out this information with FTP commands, or possibly be able to link the servers to a VPN somehow and use PHP to figure out the amount of free space, though I wouldn't know exactly how to do that, or even, if it would work...

Thanks to anyone in advance!


回答1:


If you are using IIS FTP server on the Windows machine, you can configure the IIS to include free disk space in the LIST command response.

In the IIS manager, go to your FTP site, and select FTP Directory Browsing applet. There, in the Display following information in directory listing setting, check the Available bytes.

Then, the LIST FTP command response will look like:

226-Directory has 27,906,826,240 bytes of disk space available.
226 Transfer complete.

You can test this with WinSCP FTP client, it can make use of this information. Just go to the Space available tab of the Server and Protocol Information dialog.

(I'm the author of WinSCP)


Other FTP servers support other ways to retrieve free disk space.
See How to check free space in a FTP Server?



来源:https://stackoverflow.com/questions/37737361/is-it-possible-to-determine-the-amount-of-free-space-on-a-remote-ftp-server-with

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!