Hi,
I want a batch file which will connect to an FTP server , get one DOC file and the downloaded DOC file should be renamed as Filename_Today's Date.doc format.
Please help me in creating a batch file for this.
Regards
Sanjay
Batch File -Date & Time
Moderator: DosItHelp
-
- Expert
- Posts: 80
- Joined: 04 Feb 2009 10:03
Here's a start .. might want to adjust due to regional settings for dates or others...
Code: Select all
Set "ftpFile=Script.ftp"
Set "ftpIP=xxx.xxx.xxx.xxx"
Set "DD=%Date:~3,2%" REM Get Day
Set "MM=%Date:~0,2%" REM Get Month
Set "YY=%Date:~6,4%" REM Get Year
Set "Today=%YY%%MM%%DD%"
Set "ToFile=%Today%.doc"
Echo UserID > %ftpFile%
Echo Password >> %ftpFile%
Echo bin >> %ftpFile%
Echo lcd Folder >> %ftpFile%
Echo cd Folder >> %ftpFile%
Echo Get OneDoc.File >> %ftpFile%
Echo bye >> %ftpFile%
start ftp -v -i -s:"%ftpFile%" %ftpIP%
If Exist OneDoc.file (
Ren OneDoc.file %ToFile%
)