How to not-quite-automate an FTP in WinXP

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Killer42
    Recognized Expert Expert
    • Oct 2006
    • 8429

    How to not-quite-automate an FTP in WinXP

    Hi all.

    If necessary I'll repost this in the Windows forum, but I thought this would be a good place to hit a fair cross-section of the community. Besides, anyone can see that all the best brains post here. ;-)

    I have a bit of a problem with scripting an FTP under Windows XP, and was hoping someone can shed some light on it.

    I'm quite familiar with DOS batch files, and reasonably comfortable with FTP. I have a bunch of files that I generally download to my PC each morning. I generally start by copying a bunch of commands from a text file to the clipboard, then fire up the vanilla Windows FTP client and manually log on to the FTP server. Then I paste, sit back and watch the show.

    So far, so good.

    But I'm going on leave for a few weeks, and need to automate the process for someone else to run while I'm away, as some of the files will be deleted before I get back. I can set up a batch file they can open to FTP to the appropriate server and run a script, no worries.

    BUT!!!

    How can I allow the user to provide their user ID and password to log on? Hard-coding either mine or theirs into the file is out of the question. I have tried all sorts of combinations of auto-logon turned on and off, user and pass commands in the script file, and so on. But it seems as though I can basically either code the details in the file, or make the user do everything.

    I need a way to let the FTP server stop and prompt the user (as normal) for their password (and maybe ID, but that's not so important) before continuing with the script.

    If necessary, I'll write up instructions for them to paste the commands across like I've been doing, but would really prefer to automate it.

    TIA

    Tagline: I never muss the obvious.
  • NeoPa
    Recognized Expert Moderator MVP
    • Oct 2006
    • 32633

    #2
    Killer,

    I've done lots of work in this area but I'm on holiday tomorrow and my link into the office is down.
    Mostly I've automated it fully though, rather than allowing creds to be entered.

    For the full SP on the FTP command, though, go to Windows Explorer (Windows-E) and select 'Help and Support centre' from the Help menu.
    In there search for FTP & select the option FTP from the found list.
    There's not much it doesn't tell you.

    Best of luck and let me know if you're still having problems on Thursday.

    -Ade.

    Comment

    • Killer42
      Recognized Expert Expert
      • Oct 2006
      • 8429

      #3
      I've already checked the doco for FTP. Automating it is easy. The problem is that there is part of the process that I don't want to automate, as I still need to leave the security intact.

      P.S. I've also searched Microsoft's website, thescripts, and a general Google search, without success.

      Comment

      • NeoPa
        Recognized Expert Moderator MVP
        • Oct 2006
        • 32633

        #4
        Originally posted by Killer42
        I've already checked the doco for FTP. Automating it is easy. The problem is that there is part of the process that I don't want to automate, as I still need to leave the security intact.

        P.S. I've also searched Microsoft's website, thescripts, and a general Google search, without success.
        Ok ok - I still need my head - don't bite it off.
        I did read the original post but hadn't realised you'd checked into it that far already.
        I can maybe do some more testing if I get time on Thursday for you.

        Comment

        • Killer42
          Recognized Expert Expert
          • Oct 2006
          • 8429

          #5
          Originally posted by NeoPa
          Ok ok - I still need my head - don't bite it off.
          I did read the original post but hadn't realised you'd checked into it that far already.
          I can maybe do some more testing if I get time on Thursday for you.
          Cool, thanks. I've still got a couple of weeks.

          And I wasn't intending to be snappy. :-(

          I did forget to mention that I'd searched all over the place.

          Comment

          • NeoPa
            Recognized Expert Moderator MVP
            • Oct 2006
            • 32633

            #6
            You know that's not a problem Killer - I was just having some fun ;).

            Comment

            • NeoPa
              Recognized Expert Moderator MVP
              • Oct 2006
              • 32633

              #7
              Killer,

              I have a command file (D:\Vecta\Vecta Beta.Cmd) which executes the FTP job.
              Code:
              FTP.Exe -n -s:D:\Vecta\VectaBeta.Ftp -w:16384 blinnk.net
              I have this scheduled in the last step of my SQL Server job which produces the data file.
              Code:
              At 19:00 "D:\Vecta\VectaBeta.Cmd"
              The job itself (D:\Vecta\Vecta Beta.Ftp) includes the connection security information.
              Code:
              user {LogonID} {Password}
              binary
              lcd D:\MSSQL\Backup
              delete StatPlusVecta.Zip
              bell
              put StatPlusVecta.Zip
              delete VectaSTP.Bak
              bell
              put VectaSTP.Bak
              bye
              I'm pretty sure that this will prompt you for information if you either don't pass the complete set of creds or if you don't include the 'user' line at all.

              Comment

              • sashi
                Recognized Expert Top Contributor
                • Jun 2006
                • 1749

                #8
                Hi Killer,

                I came across few links that deals with FTP scripts, kindly refer to below attached links, hope it provides some solutions. Goos luck & Take care.




                FTP - Script

                Comment

                • Killer42
                  Recognized Expert Expert
                  • Oct 2006
                  • 8429

                  #9
                  Originally posted by NeoPa
                  ...
                  I'm pretty sure that this will prompt you for information if you either don't pass the complete set of creds or if you don't include the 'user' line at all.
                  What I've found is that rather than stopping to prompt the user, it simply takes the next piece of info from the file.

                  So basically, I can either automate if fully by sticking a user ID and password in the file (ugh!), or I can make the user drive it themselves, but can't seem to combine the two.

                  Thanks, anyway. I'll check out sashi's links, but so far things are not looking promising.

                  Comment

                  • Killer42
                    Recognized Expert Expert
                    • Oct 2006
                    • 8429

                    #10
                    Originally posted by sashi
                    ...I came across few links that deals with FTP scripts...
                    Thanks, sashi - I'll check them out.

                    Comment

                    • Killer42
                      Recognized Expert Expert
                      • Oct 2006
                      • 8429

                      #11
                      Originally posted by Killer42
                      Thanks, sashi - I'll check them out.
                      Well, I've had a look.

                      As I suspected, there's a lot of fascinating info there (now bookmarked for later reading), but not what I was looking for.

                      I don't think it's possible. All samples and explanations assume that by scripting, you will want to automate the logon by including user ID and password in the script. Argh!

                      The batch file which accepts user input to an environment variable looked like a chance, until I tried it out and found that it doesn't work under XP. (At least, I assume XP was the problem - it looks as though FC now refuses to accept CON as an input file.)

                      Thanks everyone, but I might as well give up on that line of attack - I have to have this working in a couple of days. Think I'll just set up instructions for the user to log on, then copy and paste the command stream.

                      Comment

                      Working...