使用此简单脚本通过右键单击将文件上传到FTP站点

image

While there are a myriad of FTP clients available, nothing is easier than sending files to an FTP server with a right-click. Likewise, there are loads of utilities available which add this functionality to Windows, but for a geek it is quite satisfying to uninstall “yet another utility” and replace it with your own tool.

尽管有无数的FTP客户端可用,但是没有比单击鼠标右键将文件发送到FTP服务器更容易的了。 同样,有大量实用程序可以将此功能添加到Windows,但是对于极客来说,卸载“又一个实用程序”并将其替换为您自己的工具是非常令人满意的。

If you find yourself uploading files to an FTP site frequently, we have a script which makes this as easy as a right-click with no external utilities needed.

如果您发现自己经常将文件上传到FTP站点,则可以使用脚本来简化操作,就像单击鼠标右键一样,而无需任何外部实用程序。

自定义脚本 (Customizing the Script)

The batch script is ready to use, all you have to do is fill in the blanks and then add a shortcut to your Windows Send To menu. There are comments in the script to help with the setup, but we will cover them here in a bit more detail.

批处理脚本已准备就绪,可以使用,只需填写空白,然后将快捷方式添加到Windows“发送至”菜单。 脚本中有一些注释可帮助您进行设置,但我们将在此处进行更详细的介绍。

Connection Information

连接信息

There are 3 variables you will need to set in the script under the Connection Information section:

您需要在“连接信息”部分下的脚本中设置3个变量:

  • Server – The destination FTP site address (i.e. ftp.mysite.com).

    服务器–目标FTP站点地址(即ftp.mysite.com )。

  • UserName – The user name to connect with.

    UserName –要连接的用户名。
  • Password – For this variable you can hardcode the password by entering the value after the “SET Password=” or, for security reasons, have the script prompt you for the password whenever you run it. To be prompted, comment out the hardcode line by changing it to “REM SET Password=” and then uncomment the line immediately below it (remove the REM) so it reads “SET /P Password=Enter […]”.

    密码–对于此变量,您可以通过在“ SET Password =”之后输入值来对密码进行硬编码,或者出于安全原因,每次运行时,脚本都会提示您输入密码。 出现提示时,将硬代码行更改为“ REM SET Password =”,然后对其取消注释(删除REM),以使其注释为“ SET / P Password = Enter […]”。

Subdirectories on the FTP Site

FTP站点上的子目录

In the event you want the files to be uploaded to a subdirectory on the target FTP site, you simply need to edit the change directory, “cd”, line commands. You can find these lines which start with “REM ECHO cd” and then simply list the order you want to navigate through subfolders. By uncommenting these lines (removing the REM) and entering the appropriate subdirectory name after the “cd” you can traverse to your target folder. Of course, you can add more lines as needed.

如果要将文件上载到目标FTP站点上的子目录,则只需编辑更改目录“ cd”行命令。 您可以找到以“ REM ECHO cd”开头的这些行,然后仅列出要在子文件夹中导航的顺序。 通过取消注释这些行(删除REM)并在“ cd”之后输入适当的子目录名称,您可以遍历目标文件夹。 当然,您可以根据需要添加更多行。

For example, if you would like to send your files to the directory on your FTP site, “/Dir1/Files/Draft”, the lines in your script would look like this:

例如,如果您想将文件发送到FTP站点上的目录“ / Dir1 / Files / Draft”,则脚本中的行应如下所示:

ECHO cd Dir1 >> %Commands% ECHO cd Files >> %Commands% ECHO cd Draft >> %Commands%

ECHO cd Dir1 >>%Commands%ECHO cd文件>>%Commands%ECHO cd草稿>>%Commands%

局限性 (Limitations)

Generally, this script will probably fit most of your basic FTP uploading needs but there are a few limitations to be aware of:

通常,此脚本可能会满足您大多数基本的FTP上传需求,但是要注意一些限制:

  • Files will be overwritten on the FTP server without warning. Keep this in mind in the event you are uploading a file which has the same name as an existing file in the target location.

    文件将在FTP服务器上被覆盖,而不会发出警告。 如果要上传的文件与目标位置中的现有文件同名,请记住这一点。

  • You can only send files, not directories. If you select a directory and try to send it to the script, it will not work correctly.

    您只能发送文件,不能发送目录。 如果选择目录并尝试将其发送到脚本,它将无法正常工作。
  • FTP server, user name, (optionally) password and subdirectory specifications are hardcoded into the script. If you have the need to send files to multiple FTP sites and/or subdirectories, you will need a separate copy of the script (as well as another Send To shortcut) with these values set appropriately.

    FTP服务器,用户名,(可选)密码和子目录规范被硬编码到脚本中。 如果需要将文件发送到多个FTP站点和/或子目录,则将需要脚本的单独副本(以及另一个“发送到”快捷方式),并适当设置这些值。

Download SendToFTP script from How-To Geek

从How-To Geek下载SendToFTP脚本

翻译自: https://www.howtogeek.com/75180/upload-files-to-an-ftp-site-with-a-right-click-using-this-simple-script/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值