AIX

AIX

Connect with fellow AIX users and experts to gain knowledge, share insights, and solve problems.

 View Only
  • 1.  ftp script to copy files from windows server

    Posted Tue April 05, 2011 05:46 AM

    Originally posted by: GobinathP


    Dear All,

    I have the script to copy files from windows server to AIX. Please find the below script

    #!/bin/ksh

    HOST='192.168.0.74' //Windows server ip
    USER='user' //windows server username
    PASS='password' // windows server password
    SAVEDATE=`date +%m%d%H%M`
    SAVEDIRKEEP="/local/temp/interface/${SAVEDATE}/"
    set -x
    ! -d ${SAVEDIRKEEP} && mkdir -p ${SAVEDIRKEEP} //creating a directory with month,date and timestamp
    chmod -R 777 ${SAVEDIRKEEP}
    chown -R decadm:sapsys ${SAVEDIRKEEP}

    ftp -n ${HOST} <<END_SCRIPT
    quote USER ${USER}
    quote PASS ${PASS}
    cd SAPOPS
    mget *.txt /local/temp/interface/${SAVEDATE}/ \\this is location to copy the files from windows servers
    bye
    END_SCRIPT
    exit 0

    I want to copy the files from windows server (location: D:/users/olam/SAPOPS) to AIX server (/local/temp/interface/${SAVEDATE}/). When i am running the above script the files are copying to only /local/temp/interface/ location. i am not able to copy into /local/temp/interface/${SAVEDATE}/ location.

    Can anyone help me?

    Thanks in Advance.


  • 2.  Re: ftp script to copy files from windows server

    Posted Tue April 05, 2011 06:11 AM

    Originally posted by: tony.evans


    ! -d ${SAVEDIRKEEP} && mkdir -p ${SAVEDIRKEEP} //creating a directory with month,date and timestamp
    chmod -R 777 ${SAVEDIRKEEP}
    chown -R decadm:sapsys ${SAVEDIRKEEP}
    cd ${SAVEDIRKEEP}

    ftp -n ${HOST} <<END_SCRIPT
    quote USER ${USER}
    quote PASS ${PASS}
    cd SAPOPS
    mget *.txt
    bye
    END_SCRIPT
    exit 0

    cd -


  • 3.  Re: ftp script to copy files from windows server

    Posted Tue April 05, 2011 06:12 AM

    Originally posted by: tony.evans


    or you can try (untested)

    ftp -n ${HOST} <<END_SCRIPT
    quote USER ${USER}
    quote PASS ${PASS}
    cd SAPOPS
    lcd ${SAVEDIRKEEP}
    mget *.txt
    bye
    END_SCRIPT
    exit 0