XP_cmdshell

  • Hi,

    Can any one help me to copy the file from ftp server to local server using xp_cmdshell.

    Note: I wanted to do this through procedure.

    Simple copy command is working fine.

    xp_cmdshell 'copy c:\book1.csv d:\book1.csv'

    How do I use multiple commands? As I need to connect ftp server and then I need to access the directory and copy a file.

    ftp serveraddress,username, pw,get filename.

    Thanks in Advance

    Keerthy

  • keerthy.vishweshwarachar (6/24/2008)


    Hi,

    Can any one help me to copy the file from ftp server to local server using xp_cmdshell.

    Note: I wanted to do this through procedure.

    Simple copy command is working fine.

    xp_cmdshell 'copy c:\book1.csv d:\book1.csv'

    How do I use multiple commands? As I need to connect ftp server and then I need to access the directory and copy a file.

    ftp serveraddress,username, pw,get filename.

    Thanks in Advance

    Keerthy

    Make a batch file and the execute the batch file.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Thanks for your suggestion.

    Can you just help me to create a batch file

    I tried following code:

    ftp 3.104.85.96

    username

    password

    get filename

    Its opening the command prompt but its asking the username and password.

    How to automate this part

    Thanks in advance.

  • cmd:

    ftp -n -s:ftpcommand.txt

    ftpcommand.txt:

    open hostname

    user username

    pass password

    binary

    get filename

    quit

  • Thanks

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply