First i should say you very sorry to keep on troubling you. Because this is the real time application i am here working on. i am scrwed up here at this step.
Ok now i go by simple questions. I am expecting the 100% practicle code instead of theriotical explanation:
Q1) #!/bin/sh
sftp
FICO@share.dteenergy.com<<EOF
cd /remote/path/ (as i written in previous code -
"
# CONNECT TO FTP SERVER.
Set timeout -1
spawn $env(SHELL)
match_max 100000
send -- "sftp FICO@share.dteenergy.com\r"
expect -exact "Connecting to share.dteenergy.com...\r
FICO@share.dteenergy.com's password: "
send -- "ABC123\r"
expect -exact "\r
sftp> "
"
I am also not sure that i have a remote path. i asked my team no.of times for the same. They said like below:
(The above FTP server doesnt have a remote path (/remote/path/) because the above code uses the user ID and PW along with the Host name and log into it. after you login, you will have only one file. that is a "FLAT FILE" (test file). so finally we will get(move) that file from that remote server to the local path.
-----------------------------------------------------------------------
lcd /usr/sap/NXA/COMM/interface/FICO/
mget GET_FILE*
EOF
Q2) plz suggest me how could i detect the remote path if you think that we can find the same after log in to FTP server? means step by step process. FYI, this is a tool on windows O.S. and file here is with .xls extension (GET_FILE.xls)
Q3) After we find the remote path, the below code is enough to go head and push the file (GET_FILEP) from remote path to local path. FYI, local path is on Linux O.S.
Code:
sftp
FICO@share.dteenergy.com <<EOF
cd " " (remote path)
lcd /usr/sap/NXA/COMM/interface/FICO/ (local path)
mget GET_FILE*
EOF
Q4) since i should convert the flat file (GET_FILE.xls) extension into .csv, could you plz help me in sending the extensions conversion code and how i should club these both (moves the file and conversion) together to get the proper out put?
I feel it is not only help but more than that. i am certainly here to help you in return if i can. Thank you so much again. venkat