Automatic uploading and downloading of dynamic file names via FTP under Windows

Source: Internet
Author: User

A project is generated daily with a file name + date. rar file, such as the Bcpdata2012-08-31.rar file, the dynamic part is the date part, in the Windows environment variable is represented by%date:~0,10%, This file is generated to automatically upload to the FTP server, then how to do it? Here are the effective methods I've found, and I'll take a look at them here.

@echo off

echo Open IP address > Ftpcommand.txtecho FTP user name >>ftpcommand.txtecho ftp password >>ftpcommand.txtecho LCD The path to the file to be uploaded locally >>ftpcommand.txtecho the path to the upload file on the CD FTP server >>ftpcommand.txtif "%1" = = "" Pauseif "%1" = = "Get" echo Get%2%2>>ftpcommand.txtif "%1" = = "put" Echo put%2 >>ftpcommand.txtecho bye >>ftpcommand.txtftp-s:f Tpcommand.txt

Save the above script as a batch. bat file, such as Ftpcommand.bat, by using the
Upload: FtpCommand putBcpdata%date:~0,10%.rar
Download: FtpCommand get bcpdata%date:~0,10%.rar

%1 represents the first parameter of the batch, either get or put,%2, which represents the name of the file to be uploaded or downloaded, using the Windows environment variable, which enables the uploading or downloading of dynamic file names. http://www.aixchina.net/home/space.php?uid=20260&do=blog&id=32040

Automatic uploading and downloading of dynamic file names via FTP under Windows

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.