lftp sftp get - command renames existing local file with suffix tilde
Below script used for sftp get,
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.