Search code examples
ftpcmdscheduled-tasksexeintranet

Creating an executable file to download a file, then upload the file to new location


I'm having trouble finding the correct method to accomplish a relatively simple task

I'm trying to make a simple executable that I can run/schedule to run.

That 1. Downloads a file from an intranet location (192.168.100.112/file.txt) 2. Uploads the new version file to web (fpt.website.com/docs/file.txt)

There are 5 pdf files that auto generate on an intranet and I would like to keep the web versions updated. Ideally create one executable that does all 5 files at once and have the ability to do each one individually.

thanks


Solution

  • Use the windows ftp command. Is has a -s option for providing ftp "scripts". Basically just add all the commands you need to accomplish your task to something.txt for example:

    open 192.168.100.112 
    get file.txt
    close
    open fpt.website.com
    cd docs
    put file.txt
    close
    bye
    

    then do:

    ftp -s:something.txt
    

    You could make ftp scripts, one for each upload. Then put all five commands in a batch file