SFTP batch not renaming file with "put"


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting SFTP batch not renaming file with "put"
# 1  
Old 01-19-2015
SFTP batch not renaming file with "put"

I have a .ksh script that creates an sftp batch file and runs it through sftp. It works except for one thing. If I try to "put" to a different name, it doesn't use the specified remote name...it still "puts" the original local name.

I've tried both of these, and neither work...it will always put the local name to the remote path:

Code:
cd  remotepath
lcd localpath
put localfile remotefile

Code:
put localpath/localfile remotepath/remotefile

# 2  
Old 01-19-2015
Have you tried:
Code:
cd  remotepath
lcd localpath
put localfile
mv remotefileA remotefileB

Or to create a 'tempfile' with the proper name in advance (local), upload that and delete it when done.

hth
This User Gave Thanks to sea For This Post:
# 3  
Old 01-19-2015
Quote:
Originally Posted by sea
Have you tried:
Code:
cd  remotepath
lcd localpath
put localfile
mv remotefileA remotefileB

Or to create a 'tempfile' with the proper name in advance (local), upload that and delete it when done.

hth
The mv command doesn't work either...no error or warning...simply does nothing.

I modified my script to copy and name change the file to a local working folder, then sftp and that works...just weird that the put and mv in sftp aren't working.

Looking forward to the day where I don't have the option of renaming the file locally...Smilie
# 4  
Old 01-19-2015
There is a known bug that stops rename working correctly if the underlying filesystem doesn't support hard links:

https://bugs.debian.org/cgi-bin/bugr...cgi?bug=308561

So unless you can have ssh updated to a newer version on the receiving system you may have to stick with the local rename before transfer workaround.

However, due to the POODLE SSLv3 vulnerability you may have a good case to request the receiver updates their ssh version.
This User Gave Thanks to Chubler_XL For This Post:
# 5  
Old 01-19-2015
Quote:
Originally Posted by Chubler_XL
There is a known bug that stops rename working correctly if the underlying filesystem doesn't support hard links:

https://bugs.debian.org/cgi-bin/bugr...cgi?bug=308561

So unless you can have ssh updated to a newer version on the receiving system you may have to stick with the local rename before transfer workaround.

However, due to the POODLE SSLv3 vulnerability you may have a good case to request the receiver updates their ssh version.

That's good to know.

As for upgrading, I work for a major corporation with dozens of Unix servers all over the country all run by different people, different expense codes, different versions of the OS, etc, etc...so I'll grow wings and fly to Mars before I'll be able to get them to upgrade anything.

Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Bash script - Print an ascii file using specific font "Latin Modern Mono 12" "regular" "9"

Hello. System : opensuse leap 42.3 I have a bash script that build a text file. I would like the last command doing : print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt where : print_cmd ::= some printing... (1 Reply)
Discussion started by: jcdole
1 Replies

2. Shell Programming and Scripting

Renaming a file that starts with "-"

Hi I am downloading some files from the Internet. They are from different sources and they are all called -.txt that is: a dash "-" followed by a dot "." and then the file extension. So i wrote a small script that hoped will downloads the first file and then rename them once they are... (10 Replies)
Discussion started by: faizlo
10 Replies

3. UNIX for Dummies Questions & Answers

Using "mailx" command to read "to" and "cc" email addreses from input file

How to use "mailx" command to do e-mail reading the input file containing email address, where column 1 has name and column 2 containing “To” e-mail address and column 3 contains “cc” e-mail address to include with same email. Sample input file, email.txt Below is an sample code where... (2 Replies)
Discussion started by: asjaiswal
2 Replies

4. Shell Programming and Scripting

How to Write sftp through "expect" for file upload ?

Hi Experts , I am new to unix programming please tell me how to write expect and hoe to call it for automated file upload process. help me really ! (0 Replies)
Discussion started by: kulbhushan
0 Replies

5. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

6. Shell Programming and Scripting

sftp can't fine batchfile "No such file or directory"

Hi, I've got a C program that is using execlp to run a non-interactive sftp (using a batchfile) session to send some files to another system. Just before doing that, I create the batchfile called sftp_batch on the fly: V8_26_1:sun-->cat /workspace/sftp_batch cd /tmp/newsftp put test.file... (2 Replies)
Discussion started by: Fiaran
2 Replies

7. UNIX for Dummies Questions & Answers

A mechanism like "batch file of windows" in Unix

Hi all, Like in windows OS we have in unix something called "jobs"-term me if i am wrong- to run a sequence of steps which we can exceute at our own will without scheduling like corntab scheduling. can any one tell me what is the structure of this file and provide me with some info with this... (5 Replies)
Discussion started by: aixjadoo
5 Replies

8. UNIX for Dummies Questions & Answers

Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`"

Hi Friends, Can any of you explain me about the below line of code? mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'` Im not able to understand, what exactly it is doing :confused: Any help would be useful for me. Lokesha (4 Replies)
Discussion started by: Lokesha
4 Replies

9. Shell Programming and Scripting

Scripting multiple file "puts" in sFTP...

I need to send multiple files to a remote server via sFTP. I had everything set up to connect and send a single file automatically using a batch file and key authentication. Recently, however, the process has changed and we now need to send multiple files, one at a time, pausing for up to ten... (5 Replies)
Discussion started by: Cbish68
5 Replies
Login or Register to Ask a Question