Uploading using sftp file1 copied to file2

Hi All,

i am using hp-ux server and doing mput command for uploading the multiple files.
below is the code

sftp hfjr@usilehrttlsd01.com
    cd /home/sftp_dir
    mput kk1 kk2

i am getting Uploading kk1 to /home/sftp_dir/kk2.
problem is i am getting kk2 file only not kk1 file.
when i am using put command like below

sftp hfjr@usilehrttlsd01.com
    cd /home/sftp_dir
    put kk1
    put  kk2

it is working file.

so how can i use mput in my shell script

Thaks for your help advance.

Regards,
Krupa

The man page for my sftp - implementation does not mention the mput command, but it seems to me that it takes only the first argument for the local files' spec, and the optional second for the target file/directory name. So I guess in your remote copy kk1 was copied over and renamed to kk2. Try: mput kk[12]

Hi Rudic,

i have file like GPS_input.txt and GPS_input2.txt. when i try to mput GPS_input[12].txt or GPS_input[2].txt . when i am trying with this only GPS_input2.txt is chowing(it means same ptoblem).

i could use mput GPS_input*.txt , in my directory i have more then one file with same name e.g GPS_input4.txt , GPS_input_test.txt..... like this
among all i will have to sftp only GPS_input.txt and GPS_input2.txt.
do you have any advice for this situations?

Advace thanks for your helping hands.

Thanks,
Krupa

How about mput GPS_input{,2}.txt

---------- Post updated at 09:10 PM ---------- Previous update was at 09:08 PM ----------

But the way. mput uses glob by default, however, if you disable glob (man page) it will take the files literally and do not try to expand.

i am tried with below
sftp> mput GPS_input{,2).txt
stat GPS_input{,2).txt: No such file or directory

getting the No such file or directory, even though two files are there in my directory.

That should be a }
If still complains it will be because it is not expanding.

sorry, still i am getting same error
sftp> mput GPS_input{,2}.txt
stat GPS_input{,2}.txt: No such file or directory

This worked for me:

sftp> put GPS_input[1-2].txt

no , it is not working properly
Uploading GPS_input2.txt to /home/ekkk/GPS_input2.txt
GPS_input2.txt

it is there only GPS_input2.txt file and GPS_input.txt file is not there

this is the same issue.

I'm under linux env and below is the code working for me.

[mzadmin@local103 ~]$ sftp user@remote104
Connecting to remote104...
user@sai104's password:
sftp> cd /home/user/TEST
sftp> put GPS_input[1-2].txt
Uploading GPS_input1.txt to /home/mzadmin/TEST/GPS_input1.txt
GPS_input1.txt                                                                                                                                             100%    6     0.0KB/s   00:00
Uploading GPS_input2.txt to /home/mzadmin/TEST/GPS_input2.txt
GPS_input2.txt                                                                                                                                             100%    4     0.0KB/s   00:00
sftp> bye

[mzadmin@local103 ~]$ ssh user@remote104
mzadmin@remote104's password:
Last login: Fri Jun  6 15:00:09 2014 from sai103
[mzadmin@remote104 ~]$ cd TEST/
[mzadmin@remote104 TEST]$ ll
total 8
-rw-rw-r-- 1 mzadmin mzadmin 6 Jun  6 15:01 GPS_input1.txt
-rw-rw-r-- 1 mzadmin mzadmin 4 Jun  6 15:01 GPS_input2.txt
[mzadmin@remote104 TEST]$ exit
logout
Connection to remote104 closed.

Hi panyam,

my file names are GPS_input.txt and GPS_input2.txt. not GPS_input1.txt and GPS_input2.txt

thanks,
Krupa

Why can't you use

put GPS_input*.txt 

?

You want to match only GPS_input.txt and GPS_input2.txt?

if there is no other options then i will have to use this.
here is my question , we cannot use any regular expression for both the files like character and concatenation with number in files?

Thanks,
Krupa

i can not use below code, because i have so many files in same directory name like ...
GPS_input.txt,GPS_input1.txt,GPS_input2.txt,GPS_input3.txt ... like this
from above list of files, i will have to upload only two files i.e GPS_input.txt and GPS_input1.txt

put GPS_input*.txt