使用cURL检查FTPS站点上是否存在文件 [英] Check if file exists on FTPS site using cURL

查看:430
本文介绍了使用cURL检查FTPS站点上是否存在文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用cURL应用程序下载多个csv文件。我想找到一种在开始下载之前检查文件是否存在于ftps站点上的方法。如果不存在,我想找一种方法让cURL定期检查一次。
我试图为此坚持使用cURL命令,我真的不擅长.Net编程。任何帮助将不胜感激

I am using the cURL app to download multiple csv files. I want to find a way to check if the file exists on the ftps site before kicking off the download. If it doesn't exist I would like to find a way for cURL to check again at regular intervals. I am trying to stick to using cURL commands for this I am really not good at .Net programming. Any help would be appreciated

推荐答案

$ curl ftp://[host]/[path] --ssl --head

(您可能还需要 -k

-ssl :尝试使用SSL / TLS进行连接

--ssl: Try to use SSL/TLS for the connection

--head :在FTP上使用或FILE文件,curl仅显示文件大小和最后修改时间

--head: When used on an FTP or FILE file, curl displays the file size and last modification time only

如果文件不存在,它将返回错误。它不会一直检查,只会检查一次,因此您需要使用一些scheduler / cron / script或其他方法进行重复检查。

It will return an error if the file doesn't exist. It will not keep checking, it will only check once so you need to do the repeated checking using some scheduler/cron/script or whatever.

这篇关于使用cURL检查FTPS站点上是否存在文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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