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.
|