[SOLVED] bash script to get only the latest file from server
by Pedroski from LinuxQuestions.org on (#6KD0X)
This bash script gets messages stored on the server.
How can I alter it to only get the latest message, or messages after a certain date?
Quote:
Thanks for any tips!
How can I alter it to only get the latest message, or messages after a certain date?
Quote:
# now get the latest HW echo "Fetching any messages ... " # ssh -p 22 -i ~/.ssh/my_cloud_ed25519 pedro@123.123.123.123 user="pedro" server="123.123.123.123" Answers="/home/pedro/messages" # where the uploaded contact messages go on the cloud server # can't get the email to work path1="/var/www/pedro.com/public_html/contact/messages" echo "Second, get the files from the remote server to this computer." rsync -av --remove-source-files --progress -e 'ssh -p 22 -i ~/.ssh/my_cloud_ed25519' $user@$server:${path1}/* "${Answers}" echo "Got the files and saved them to "$Answers echo "All done!" |