cURL ftp传输场景

发布于 2024-11-08 18:53:24 字数 445 浏览 7 评论 0原文

我正在尝试使用 MAtlab 内的 cURL 自动从 ftp 站点上传和下载,但遇到了困难。本质上,我希望一台计算机不断地将新文件上传到 ftp,但由于 ftp 上有磁盘配额,我希望另一台计算机不断从 ftp 下载和删除这些相同的文件。

很简单,但我的问题是想确保我不会下载仍在上传的文件,从而导致文件不完整。

首先,cURL 有没有办法让文件在整个文件上传之前无法从 ftp 站点下载?

解决这个问题的一种方法是,我可以将文件上传到一个目录,一旦上传完成,我就可以将它们传输到 ftp 站点上的“完成”目录。然后下载程序只会在“Finished”目录中查找文件。但是,我不知道如何使用 cURL 在 ftp 站点内传输文件。

是否可以使用 cURL 在 ftp 站点上的目录之间传输文件,而无需先下载文件?

如果其他人对如何执行此任务有更好的想法,我很想听听他们的意见!

谢谢!

I'm trying to automate uploading and downloading from an ftp site using cURL inside MAtlab, but I'm having difficulties. Essentially I want one computer continuously uploading new files to an ftp, yet since there is a disk quota on the ftp, I want another computer continuously downloading and removing those same files from the ftp.

Easy enough, but my problem arises from wanting to make sure that I don't download a file that is still being uploaded, thereby resulting in an incomplete file.

First off, is there a way in cURL to make it so that the file wouldn't be available for download from the ftp site until the entire file has been uploaded?

One way around this is that I could upload files to one directory, and once they are finished uploading, then I could transfer them to a "Finished" directory on the ftp site. Then the download program would only look for files inside that "Finished" directory. However, I don't know how to transfer files within an ftp site using cURL.

Is it possible to transfer files between directories on an ftp site using cURL without having to download the file first?

And if anyone else has better ideas on how to perform this task, I'd love to hear em!

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

盛装女皇 2024-11-15 18:53:24

您可以使用特殊名称上传文件,然后在完成后重命名,并让下载客户端仅下载具有特殊“上传完成”名称样式的文件。

或者按照您所说的在目录之间移动它们(这本质上也是重命名,只是更改目录)。

使用命令行curl,您可以在上传后使用-Q选项执行“原始”命令,您甚至可以在curl常见问题解答中找到一个小示例:http://curl.haxx.se/docs/faq.html#Can_I_use_curl_to_delete_rename

You can upload the files using a special name and then rename it when done, and have the download client only download files with that special "upload completed" name style.

Or you move them between directories just as you say (which is essentially a rename as well, just changing the directory too).

With the command line curl, you can perform "raw" commands after the upload with the -Q option and you can even find a tiny example in the curl FAQ: http://curl.haxx.se/docs/faq.html#Can_I_use_curl_to_delete_rename

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文