Announcement

Collapse
No announcement yet.

ftp using windows batch file and redirecting each step in log file

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • ftp using windows batch file and redirecting each step in log file

    Hi ,

    I am trying to do a ftp and just put some files that are transferred from database,

    though the ftp is working fine but the moment i try to redirect as to monitor the steps in some log file it is not working i just wonder y?

    the same thing was possible to do quite easily in unix

    please let me know how i can achieve this.

    below is my script:

    ftp -d -v -i ACCMAIN > accmain_status.log
    user ACCUSER userpwd
    type ascii
    delete 'ACCMAIN.DATA.DEV'
    site lrecl=289
    put ACCMAIN.DATA.DEV 'ACCMAIN.DATA.DEV'
    quit



    on executing this the cursor just blinks in the command prompt, the problem all here is with the way i have redirected the output to log file. Someone please help me the best way to achieve it, as i am novice to windows batch programming.


    in unix we use the same as

    ftp -d -v -i ACCMAIN <<XEND > accmain_status.log
    user ACCUSER userpwd
    type ascii
    delete 'ACCMAIN.DATA.DEV'
    site lrecl=289
    put ACCMAIN.DATA.DEV 'ACCMAIN.DATA.DEV'
    quit
    XEND

    What can be the equivalent dos command for XEND here ?


    P.S the server name and userid and pwd are changed.

  • #2
    Re: ftp using windows batch file and redirecting each step in log file

    Take a look at Windows FTP command line switches: ftp -?

    You'll note that ftp.exe assumes you to put your script commands into a file and pass the file contents as an argument to the program.

    I've never heard about XEND command, so I have no idea what the equivalent would be.

    -vP

    Comment


    • #3
      Re: ftp using windows batch file and redirecting each step in log file

      Hi,

      It can be done using FTP command with -s swith.

      1) Create a text file with following contents (Description in brackts , ).Name this txt file as script.txt

      o exapmle (name of your ftp server)
      user (user name to connect)
      passwd (password for that user)
      mput or mget file.txt ( your commands which needs to be executed)
      exit.



      2) Run below command from either a command line or batch file.

      ftp -s:C:\script.txt >>C:\ftplog.txt

      3) C:\script.txt is the path for that script file and C:\ftplog.txt is the path to the output log file.




      -SubhashChy

      Comment

      Working...
      X