WinSCP:校验和计算(不支持操作.) [英] WinSCP: Checksum calculation (Operation not supported.)

查看:216
本文介绍了WinSCP:校验和计算(不支持操作.)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在C#WinForms应用程序中使用WinSCP .NET程序集,我想将远程目录与本地目录同步.这在WinSCP上非常有用.

但是在同步开始之前,我想检查远程控制器和语言环境控制器是否完全不同.为此,我想使用WinSCP中的 CalculateFileChecksum()方法.

使用对话框中显示的算法名称(如果显示的是全部).如果未显示任何内容,则不能使用 Session.CalculateFileChecksum .

请注意,您在 CalculateFileChecksum 中使用了算法名称(例如 md5 sha-1 ),但没有使用FTP命令名称(例如 XMD5 XSHA1 ).

请注意,您的服务器很可能根本不支持校验和计算,因为MD5是迄今为止使用最广泛的一种.因此,如果不支持MD5,则不可能有其他任何支持.


但是表表示FTP应该支持以下内容

受支持(HASH,XSHA1,XSHA256,XSHA512,MD5,XMD5,XCRC).

该表显示WinSCP支持这些FTP命令来计算校验和.这些命令实际上均未标准化,并且不需要FTP服务器来支持其中任何一个.

请参见 FTP:复制,检查完整性并删除.


此外,请注意,您不能将 Session.CalculateFileChecksum 用于目录,而只能用于文件.

I'm using WinSCP .NET assembly in my C# WinForms application and I want to synchronize my remote directory with my local directory. This works great with WinSCP.

But before the synchronisation starts, I want to check if the remote and the locale directors are different at all. To do this, I want to use the CalculateFileChecksum() method from WinSCP. Here is an example for what I'm trying to do.

And here is the code, where I call the method:

var checksum =
    session.CalculateFileChecksum("md5", Properties.Settings.Default.ftpServerModDir);

The first string is the algorithm for calculating the checksum, the second is the remote path.

If I run this code, I get the following exception.

Operation not supported.

It looks like, my FTP server does not support MD5, but this table says that FTP should support the following

Supported (HASH, XSHA1, XSHA256, XSHA512, MD5, XMD5, XCRC).

I tried HASH, MD5 and XMD5 already but always get the same exception.

Has anyone an idea how to get this working? Or how can I check which algorithm my server supports?

Thanks for your help!

解决方案

how can I check which algorithm my server supports?

Connect with WinSCP GUI to your server, pick a file and go to Files > Properties, select Checksum tab. And see, what algorithms the GUI offers:

Use algorithm name as shown in the dialog, if any is shown is all. If none is shown, you cannot use the Session.CalculateFileChecksum.

Note that you use an algorithm name in the CalculateFileChecksum (like md5 or sha-1), you do not use an FTP command name (like XMD5, XSHA1).

Note that it's quite likely, that your server does not support checksum calculation at all, as MD5 is by far the most widely used one. So if MD5 is not supported, it's not likely that any other is.


but this table says that FTP should support the following

Supported (HASH, XSHA1, XSHA256, XSHA512, MD5, XMD5, XCRC).

The table says that WinSCP supports those FTP commands to calculate a checksum. None of these commands are actually standardized and FTP server is not required to support any of them.

See FTP: copy, check integrity and delete.


Also, note that you cannot use Session.CalculateFileChecksum for a directory, only for a file.

这篇关于WinSCP:校验和计算(不支持操作.)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆