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

Hi,

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 hours...do you recommend I just setup a simple scheduled task to run from the domain controller?

Thanks ALOT for your help!
rubydesiAsked:
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.

omarfaridCommented:
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

username
password
lcd c:\ftpdir
cd /remotedir
ascii
prompt
mput fb*
quit

have a .bat file that contains

ftp -s:ftp.txt server_ip

then use the task scheduler to shedule it
0

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:
Hi,

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?
0
omarfaridCommented:
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%

0
Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

rubydesiAuthor Commented:
OK, my ftp.txt file is

userpassword
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.
0
rubydesiAuthor Commented:
Nevermind on previous question, it is all working successfully now.
0
omarfaridCommented:
I was a way from my computer, any help needed?
0
rubydesiAuthor Commented:
Nope, working 100%, thanks again.
0
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.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.