Need to setup scheduled batch file to FTP a file to network directory


I have a DOS based machine that measures the weight of a product, stores it in memory and then writes data to a text file every 2 hours. I want to setup a scheduled batch file that copies this text file via FTP to a location on a network dive and automatically adds a date stamp to the end of the file.

The location of the text file is: ftp://10.X.X.X/STATEX/statex.txt

Example of where I would like the file FTPed/copied: //server/share/statex.txt

Can the file be date stamped similar to this syntax: /statex12-11-2008.txt?

I would like to run this batch file every 12-24 you recommend I just setup a simple scheduled task to run from the domain controller?

Thanks ALOT for your help!
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

to set filename with date

set file=fb%date:~10,4%%date:~4,2%%date:~7,2%

to automatically ftp, have an ftp file ( e.g. ftp.txt) like

lcd c:\ftpdir
cd /remotedir
mput fb*

have a .bat file that contains

ftp -s:ftp.txt server_ip

then use the task scheduler to shedule it

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
rubydesiAuthor Commented:

Thanks for the reply.

Whats the exact syntax for setting the filename with the date including the filename?

You have: set file=fb%date:~10,4%%date:~4,2%%date:~7,2% - where does statex.txt fit into this string?
what I gave was an example and you need to customize:

set file=statex%date:~10,4%%date:~4,2%%date:~7,2%.txt
rename statex.txt %file%

Active Protection takes the fight to cryptojacking

While there were several headline-grabbing ransomware attacks during in 2017, another big threat started appearing at the same time that didn’t get the same coverage – illicit cryptomining.

rubydesiAuthor Commented:
OK, my ftp.txt file is

lcd \\server\share\Statex
cd statex
get statex.txt

This has copied the file from the DOS machine to the network share.

Where in the process can I use the "set file" batch command? I only need the network share copy of the file date stamped, so can I tack that onto the end of the batch file AFTER ftp.txt has finished? Or should I create a second batch file that runs after the first one finishes?

Thanks again.
rubydesiAuthor Commented:
Nevermind on previous question, it is all working successfully now.
I was a way from my computer, any help needed?
rubydesiAuthor Commented:
Nope, working 100%, thanks again.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
File Sharing Software

From novice to tech pro — start learning today.