• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 306
  • Last Modified:

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!
0
rubydesi
Asked:
rubydesi
  • 4
  • 3
1 Solution
 
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
 
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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
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

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now