Variable for FTP (command prompt)

April 4, 2011 at 02:25:08
Specs: Windows Vista
Hey everyone, I'm currently trying to download files using command prompt via a FTP server.
I'm using a variable as the files would be downloaded at a 15 minute interval.
The file name is according to the current date and the date format is YYMMDD.

This is my first batch file, in which i would be creating a folder for the text files to be placed in.

cd C:\data2
set today=%date:~12,4%%date:~4,2%%date:~7,2%
mkdir %today%
cd C:\Users\newacc
call C:\Users\newacc\Desktop\ftp!\FTP!!.bat

The batch file would then call for another batch file, which would run the downloading of the text files.

set now=%date:~12,4%%date:~4,2%%date:~7,2%
ftp -v -i -s:C:\Users\newacc\Desktop\ftp!\FTP!.txt

open 10.66.xx.xx
lcd C:\data2\%now%
cd C:\data\%now%
mget "*.*"

As there are several text files in each folder, I use mget to retrieve the files. However, the problem I am currently facing is that when the script is running, (lcd and cd), the directory cannot be found. I'm guessing its due to the variable not being recognised.

Someone please help me! I'm really bad at programming and have been searching online for several hours but with no solution. I'd really appreciate any help.

Thanks in advance.

See More: Variable for FTP (command prompt)

Report •

April 4, 2011 at 22:38:48
Its okay everyone! I've solved my problem after enduring a few more hours of searching.


Report •
Related Solutions

Ask Question