仅将最新文件夹上传到 FTP(本地 -> 远程)

Only upload the latest folder to FTP (Local -> Remote)

我需要能够每天将本地文件夹(每天创建)上传到远程 FTP。

我搞砸了 WinSCP 文件掩码(即 put -filemask="*>=today" C:\local\ /)和 运行 问题,它会上传最新的文件夹(包含子文件),但它也会上传其余文件夹在目录中。 (它们是空的)然后我意识到文件掩码仅适用于文件,不适用于文件夹。

然后我发现了这个线程:

考虑到该线程已有几年历史,WinSCP 脚本现在支持这样的功能吗?不幸的是,我是 PowerShell 的新手。

感谢您的宝贵时间。

WinSCP 不支持文件夹的时间限制。

但是发生了什么变化(自 ) is that now you can prevent WinSCP from creating the empty folders. Use -rawtransfersettings switch with ExcludeEmptyDirectories setting.

put -rawtransfersettings ExcludeEmptyDirectories=1 -filemask="*>=today" C:\local\ /

如果您确实需要上传最新的文件夹(与上传包含最新文件的文件夹相反),请使用 WinSCP .NET assembly from your favourite language (like PowerShell) is still the way to go, as shown in the