【问题标题】:Rename local file before upload to FTP in Windows command-line在 Windows 命令行中上传到 FTP 之前重命名本地文件
【发布时间】:2018-07-24 08:28:16
【问题描述】:

我有以下脚本由于某种原因无法正常工作。 我需要每天重命名(附加当前日期)Feed.txt 文件并将其上传到 FTP。我错过了什么?

eco
secret_pwd
ascii
lcd C:\Jobs
rename Feed*.txt Feed_%date:~-4,4%%date:~-7,2%%date:~-10,2%.txt
cd Uploads
put Feed_%date:~-4,4%%date:~-7,2%%date:~-10,2%.txt
quit

【问题讨论】:

    标签: windows batch-file cmd ftp rename


    【解决方案1】:

    renameftp.exe 脚本中重命名 FTP 服务器上的文件。

    当您要重命名本地文件时。为此,您需要使用cmd.exerename 命令,而不是ftp.exe

    因此,要么将rename 移动到执行您的 FTP 脚本的批处理文件中(如果有)。

    或在rename 前加上! 以指示ftp.exe 转义到cmd.exe

    【讨论】:

      猜你喜欢
      • 2011-05-19
      • 2016-09-21
      • 2016-07-13
      • 2019-01-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-01-23
      • 2014-12-19
      相关资源
      最近更新 更多