Announcement

Collapse
No announcement yet.

Remotley run script on server to call FTP script

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

  • Remotley run script on server to call FTP script

    Hi all,

    The title is a bit dodgy I know, but here's what I need:

    I currently remotely log onto a server and run the following script:

    @echo off
    cd C:\directory
    ftp -s:myscript.txt
    copy file1* "C:\destination directory"
    rename file1* file2.txt
    copy file2.txt "D:\destination directory"
    del file2.txt

    The FTP script is as follows:

    open "IP Address"
    username
    password
    cd /directory
    mget file1*
    y
    bye

    This works fine, however I now need to start this script from a local machine (as this task is to be transferred to someone without server access), but all the scripts tasks still need to occur on this server.

    I tried mapping "Server\directory" locally, but when I run the script, it says "The system cannot find the path specified". I then tried ammending the script using the PushD command (which I found on this site ) as follows:

    @echo off
    PushD "\\ServerName\C$"
    cd "\directory"
    ftp -s:myscript.txt

    But I then get "ftp: connect :Unknown error number", so it is running from the correct directory, but not connecting to the ftp site.

    Sorry to go on a bit, and if this has already been answered I apologise, but I did spend about 2 hours searching for a solution!

    Can anyone shed any light on this please?

    Many thanks,

    Mrt2005

  • #2
    Re: Remotley run script on server to call FTP script

    psexec maybe?
    Gareth Howells

    BSc (Hons), MBCS, MCP, MCDST, ICCE

    Any advice is given in good faith and without warranty.

    Please give reputation points if somebody has helped you.

    "For by now I could have stretched out my hand and struck you and your people with a plague that would have wiped you off the Earth." (Exodus 9:15) - I could kill you with my thumb.

    "Everything that lives and moves will be food for you." (Genesis 9:3) - For every animal you don't eat, I'm going to eat three.

    Comment


    • #3
      Re: Remotley run script on server to call FTP script

      Don't think I could use this , the reason being this is going to be run by someone who is relatively computer illiterate, who can only have access to thier machine. Ideally, I just want them to have to double click a batch file and that's all, and just when I thought I'd cracked it, the ftp script fell over

      Thanks anyway.

      Mrt2005

      PS. I've never actually used psexec, is it any good?

      Comment


      • #4
        Re: Remotley run script on server to call FTP script

        If you can't use psexec (or a similar tool - they're all much the same), then you can't do this. Why can't you create a script that runs psexec to execute the batch file on the server?

        Try psexec and see - run it with /? to see the usage.
        Gareth Howells

        BSc (Hons), MBCS, MCP, MCDST, ICCE

        Any advice is given in good faith and without warranty.

        Please give reputation points if somebody has helped you.

        "For by now I could have stretched out my hand and struck you and your people with a plague that would have wiped you off the Earth." (Exodus 9:15) - I could kill you with my thumb.

        "Everything that lives and moves will be food for you." (Genesis 9:3) - For every animal you don't eat, I'm going to eat three.

        Comment


        • #5
          Re: Remotley run script on server to call FTP script

          Why can't you create a script that runs psexec to execute the batch file on the server?
          Ha, why didn't I think of that!?

          Thanks, I'll give that a try and let you know how I get on.

          Cheers,

          Mrt2005

          Comment


          • #6
            Re: Remotley run script on server to call FTP script

            The reason I suggest creating a script to run psexec rather than just creating a shortcut to it is that you will likely have to include appropriate user credentials as arguements to psexec, which you presumably don't want this user to have. Create a VBS and encrypt it so that the user can't see the credentials.
            Gareth Howells

            BSc (Hons), MBCS, MCP, MCDST, ICCE

            Any advice is given in good faith and without warranty.

            Please give reputation points if somebody has helped you.

            "For by now I could have stretched out my hand and struck you and your people with a plague that would have wiped you off the Earth." (Exodus 9:15) - I could kill you with my thumb.

            "Everything that lives and moves will be food for you." (Genesis 9:3) - For every animal you don't eat, I'm going to eat three.

            Comment

            Working...
            X