Announcement

Collapse
No announcement yet.

XP command line FTP programme

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

  • XP command line FTP programme

    Does this keep a log of failed transactions????
    Chief Lemon Buyer no more Linux sucks but not as much
    Weather nut and sad git.

    My Weather Page

  • #2
    No - all errors are printed on the screen.

    If you are running it with a script file, then you could redirect the output to a file by adding
    >> ftplog.txt
    to the end of the ftp command.

    Comment


    • #3
      Now the next question is how do I ftp via the command line in a script???
      Chief Lemon Buyer no more Linux sucks but not as much
      Weather nut and sad git.

      My Weather Page

      Comment


      • #4
        ftp host -s:response.txt >> ftplog.log

        where host is the ftp server to connect to.
        response.txt is a text file containing all your ftp commands one on each line like this:

        username
        password
        bin
        cd /
        prompt
        mget 2004????.txt
        mput 2003????.*
        bye

        if you are using mput or mget you need to use prompt or it will get stuck waiting for y/n answers.

        Comment


        • #5
          Dumb question time. Can you use wildcards with mput or do you have to specify each file one by one. Windoze help sort of hints that you can put all the files on one line but doesn't show the syntax.
          Chief Lemon Buyer no more Linux sucks but not as much
          Weather nut and sad git.

          My Weather Page

          Comment


          • #6
            You can use wildcards as I have shown in my example:
            ? replaces one character
            * replaces 0 or more characters

            I'm not sure, but I don't think you can do:
            mput a.txt b.txt c.txt

            instead you would do:
            mput *.txt

            or:
            mput ?.txt

            and as I mentioned you should have a prompt statement before any mput or mget (you only need one prompt statement - a second prompt statement will turn the questions back on)

            mget and mput are also useful if you don't know the exact name of the file. I have scripts that move files around that start with a known bit of text then have the date they were created in the filename (fileYYYYMMDDhhmmss.txt) so I move them around with the wildcard file??????????????.txt
            Last edited by Rob(QG); 13 July 2004, 00:07.

            Comment


            • #7
              Ah the batch files works just had to change the order to the following

              ftp -slus.txt ftp.plus.net >> error.txt

              and bingo.

              Now I got to schedule the damn thing.
              Chief Lemon Buyer no more Linux sucks but not as much
              Weather nut and sad git.

              My Weather Page

              Comment


              • #8
                Lets see what happens hopefully I'll get loads of errors.
                Chief Lemon Buyer no more Linux sucks but not as much
                Weather nut and sad git.

                My Weather Page

                Comment


                • #9
                  Help new problem when I schedule it it's failing to create an log.

                  Exit code is one whatever that means.
                  Last edited by The PIT; 13 July 2004, 10:17.
                  Chief Lemon Buyer no more Linux sucks but not as much
                  Weather nut and sad git.

                  My Weather Page

                  Comment


                  • #10
                    Originally posted by The PIT
                    Ah the batch files works just had to change the order to the following

                    ftp -slus.txt ftp.plus.net >> error.txt
                    Oops - forgot that ftp was picky about having the host after the switches.We've switched to using VB programs with the Mabry FTP/X control instead of command line ftp, so I'm a bit rusty,

                    Comment


                    • #11
                      Problem is it isn't creating the error log.
                      Chief Lemon Buyer no more Linux sucks but not as much
                      Weather nut and sad git.

                      My Weather Page

                      Comment


                      • #12
                        It should give you a complete list of all the messages that would have appeared on the screen if you had typed the same stuff in interactively.

                        The exit code isn't useful as the last ftp command is bye or quit - which is gonna succeed.

                        Any errors that occur should be in the error.txt file, tho - you just have to check it manually.

                        Trapping errors is exactly why we don't use ftp command line anymore.


                        Oops - missed that this happened when scheduled. You may need to create a batchfile that runs the ftp command, and schedule that instead.

                        Comment


                        • #13
                          Just remembered XP has it's paths mixed up so it doesn't know where the ftp programme is.

                          So I just added the path statement to the batch file that launches it.

                          I'll correct that error at another time.
                          Chief Lemon Buyer no more Linux sucks but not as much
                          Weather nut and sad git.

                          My Weather Page

                          Comment


                          • #14
                            In the scheduled task you can set the working directory.

                            Comment


                            • #15
                              Yes but the ftp programme hides in the windows directory and windows doesn't know where it is. The batch file is in a directory called test.

                              It's a problem that does occur with some XP installs. So any dos command I run from command prompt results in unknown command.

                              This probably happened after my problems with a Norton Antivirus uninstall and re-install.
                              Chief Lemon Buyer no more Linux sucks but not as much
                              Weather nut and sad git.

                              My Weather Page

                              Comment

                              Working...
                              X