Loading ...
Sorry, an error occurred while loading the content.

FTP BATCH

Expand Messages
  • alex
    Hello all i need help with a batch file i wrote a batch file to download a file from an ftp site rename the file then move it over to a folder, for some reason
    Message 1 of 3 , Apr 6, 2012
    • 0 Attachment
      Hello all
      i need help with a batch file i wrote a batch file to download a file from an ftp site rename the file then move it over to a folder, for some reason its not working maybe i am missing something. can someone please help me out. this is what i have

      ftp FTP.XXXXX.COM
      XXXXXX
      XXXXXX
      prompt
      mget *rpt.zip
      quit
      copy *.zip T:\FTP-EDS\Storage\
      move *.zip T:\FTP-EDS
      cd T:\FTP-EDS
      del XEDS /q
      T:\FTP-EDS\Batch\winrar e -pBSCU14CNS *.zip
      del *.zip /q
      ren *.* XEDS

      i also wrote a vb script
      #Connect to ftp.myhost.com and download all the files inside the www folder.
      #define some variables
      host="ftp.myhost.com"
      user="carl"
      password="1234567890"

      #this is a label, used by the GOTO command
      :start
      #connect to FTP server
      result=openhost(host,user,password)

      #check what happened with ftpopenhost
      if(isequal(result,"OK"))
      print("CONNECTED")
      else
      print("Cannot connect. Wait 5 seconds and try again")
      sleep("5")
      goto start
      end if

      #do the stuff
      localchdir("C:\localwww\")
      chdir("www")
      getfile("*.*")

      closehost()
      print("FINISHED")
      exit



      thanks

      alex
    • John O'Regan
      Dear Alex, It s difficult to diagnose the problem when I don t know how your particular system is set up. But one or two things leapt out at me. First, I
      Message 2 of 3 , Apr 6, 2012
      • 0 Attachment
        Dear Alex,

        It's difficult to diagnose the problem when I don't know how your
        particular system is set up. But one or two things leapt out at me.
        First, I think

        cd T:\FTP-EDS

        should be

        cd /d T:\FTP-EDS

        I'm also puzzled by

        del XEDS /q

        Is XEDS a folder? Thirdly, the RENAME command doesn't work as below

        ren *.* XEDS

        Type REN /? from the command line for help and syntax. Lastly, after
        the PROMPT command and before you download the zip files, insert

        BIN

        on a line by itself, just to be on the safe side,

        HTH,
        John
      • John O'Regan
        Hi Again, I found a great link to a page on DosTips.com all about FTP scripts. http://www.dostips.com/DtTipsFtpBatchScript.php It should resolve all your
        Message 3 of 3 , Apr 6, 2012
        • 0 Attachment
          Hi Again,

          I found a great link to a page on DosTips.com all about FTP scripts.

          http://www.dostips.com/DtTipsFtpBatchScript.php

          It should resolve all your issues,

          good luck,
          John
        Your message has been successfully submitted and would be delivered to recipients shortly.