开发者

Need Batch script in windows to upload files to a particular ftp location [closed]

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. 开发者_如何学运维 Closed 11 years ago.

I have several backup files in a location, say C:\backup_folder\... Now I need a batch script (.bat), so that all files under C:\backup_folder\*.zip will be moved to a particular FTP location (ftp.mysite.com).

Also, if the file already exists on the FTP site, they must be overwritten with the new file... Can anyone show me a script that performs these backups?


The trick with automated file xfer with Windows (for me at least) has always been using the correct commandline upload tool. For ME, when I've wanted a shell-scriptable tool, that usually ends up being rsync from cygwin. But since you asked about Windows batch with FTP (as opposed to a safer, more reliable solution, you might want to try using a Windows build of wput

Since you want to overwrite the file each time, you would use the -u (re-upload) option. I found wput supported most of the FTP options I wanted, and should handle this job. Although I absolutely agree with your desire to always re-upload the entire file, you CAN set it for a few optimizations that you might find handy if you're uploading over a slow link, like using a timestamp comparison to decide if you don't need to upload (-N). Another option backup scripts MAY want is to remove your source file after a successful upload (-R option).

I just feel it's wise to point out that FTP isn't nearly as reliable a protocol as I would want in a backup script ... but your desire to always re-upload the file(s) is a good one.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜