使用cygwin和curl使用crontab将文件上传到ftp

使用bash脚本将文件上传到ftp服务器时遇到问题,我尝试在cygwin上运行

该脚本如下所示:

#!\bin\bash
date="$(date +%Y_%j -d "5 day ago")"
file="C:/directory/${date}filename with spaces.tsf"
### Upload file to ftp
curl --user user:psw --upload-file "$file" ftp://server/directory/

输出为:'!rl: Can't open 'C:/directory/2019_317filename with spaces.tsf

另一方面,从命令行运行curl并将相同的文件上传到相同的ftp服务器就可以了

请帮助我!

snow2059 回答:使用cygwin和curl使用crontab将文件上传到ftp

在cygwin中,最好使用UNIX / Linux路径格式。尝试通过以下方式格式化文件名:

 file="/cygdrive/c/directory/${date}filename with spaces.tsf"
本文链接:https://www.f2er.com/3097355.html

大家都在问