如何从.NET应用程序中的FTP协议获取目录文件大小 [英] How to get a directories file size from an FTP protocol in a .NET application
问题描述
我目前正在制作一个小型.NET控制台应用程序,以将某些文件自动备份到服务器上.我遇到的问题是,我的天气恶劣,导致电源和网络中断.在这段时间内,我注意到我的文件中有很大一部分都没有通过或损坏.我想知道是否有一种方法可以获取另一端的文件夹大小,并查看文件名,文件数和总目录大小是否匹配.我已经尝试过使用WinSCP和NcFTP作为传输文件的方法,但是对于获得适当的文件大小,我还没有看到任何东西.
I am currently making a small .NET console application to do an automateed backup of some of my files onto my server. The issue that I am running into is that I've had some bad weather on my end which led to some power and network outages. During this time I noticed that a good portion of my files didn't go through or got corrupt. I was wondering if there was a way to get a size of the folder on the other end and see if the file names, number of files, and total directory size match up. I've tried WinSCP and NcFTP as ways to transfer files over, but I haven't seen anything regarding getting a proper filesize.
这几乎是Windows到Windows的传输,因此,如果有一个命令行参数可以通过FTP客户端给我一个合适的大小,就可以了.
This is pretty much a windows to windows transfer so if there is a command line argument that gives me back a size through the FTP client that would be great.
推荐答案
没有标准的方法来请求此目录中文件的总大小".您可以通过 SIZE file.txt
分别要求每个文件的大小,也可以要求整个目录的 ls -l </code>并解析出文件的大小.
There is no standard way to request "total size of files in this directory". You can ask for each file size individually via SIZE file.txt
, or you can ask for ls -l
of an entire directory and parse the file sizes out.
这篇关于如何从.NET应用程序中的FTP协议获取目录文件大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!