I need to get only the last file from sftp, indicating their date, for example, yyyy-mm-dd. I tried the command to be low, but it will get the whole file that is in the directory.
latest_file = `ls -ltr | tail -1 | awk '{print $9}'`
scp -r $latest_file username@server_name:/path /my/directory
Is there any command to get the latest file from sftp using a shell script?
source
share