LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   lftp sftp get - command renames existing local file with suffix tilde (https://www.linuxquestions.org/questions/linux-newbie-8/lftp-sftp-get-command-renames-existing-local-file-with-suffix-tilde-4175529017/)

vhegde 12-22-2014 12:17 PM

lftp sftp get - command renames existing local file with suffix tilde
 
Hi,
Below script used for sftp get,
#/bin/bash
USER=xxx
PASS=xxx
HOST=xxx
REMOTE_FILE=$1
LOCAL_FILE_LOC=$2
cd $LOCAL_FILE_LOC
lftp sftp://$USER:$PASS@$HOST:10022 -e "get $REMOTE_FILE; bye"

If file does not exist in sftp server, and file (same as remote file name) exists in local dir, above script throws error and renames local file with suffix ~.
For example: If file name is 'xyz_file' after script execution it throws error: get: Access failed: /xyz_file: Specified file path is invalid. and renames the local file to 'xyz_file~'
Any idea why its happening.

JeremyBoden 12-22-2014 07:50 PM

Do you work for Sony? :doh:

You've hard-coded all the security information into that little script...

veerain 12-23-2014 03:00 AM

See man page of lftp

man lftp

search for xfer:make-backup option and change it as your liking in the configuration file of lftp.


All times are GMT -5. The time now is 12:07 PM.