开发者

How to limit the upload speed of windows FTP script

开发者 https://www.devze.com 2023-02-17 15:48 出处:网络
I\'m writing a script to automatically backup a folder to a FTP site.Nothing fancy just a batch file that is triggered every so often.The problem is that my home internet connection is a little slow,

I'm writing a script to automatically backup a folder to a FTP site. Nothing fancy just a batch file that is triggered every so often. The problem is that my home internet connection is a little slow, so when it is uploading it makes doing any online tasks painfully slow, almost unbearable.

Is there a way to limit the bandwidth using the command line? Here is an example of the script I am using which is being called by another file.

@echo off 
echo user 'username'> ftp.dat
echo 'pw'>> ftp.dat
echo bin>> ftp.dat
echo put %1 >> ftp.dat 
echo quit>> ftp.dat
ftp -n -s:ftp.dat 'HOST' 
del ftp.dat

I realize the simple answers are to backup locally, reduce the frequenc开发者_如何学运维y of uploads, get a better ISP, or use some 3rd party tool. But none of those are ideal for me and I would like to keep it as simple as possible. Any suggestions?


Unfortunately the Microsoft Windows command-line FTP client can't limit the bandwidth, but there are other commandline light-weight tools. So even though you specifically wrote that you didn't want to use 3rd party toole, you should take a look at wput. Your task, including bandwidth limitation, can be performed by this one-liner:

wput C:\path\to\localfile.txt ftp://username:pw@HOST/yourfile.txt --limit-rate=100K
0

精彩评论

暂无评论...
验证码 换一张
取 消