scp/ssh tail(multiple file) remote copy
I currently have a crontab running a script like so..............
/usr/bin/scp username@x.x.x.x:/data/noaa/bigross/'*.Z' /data/products/hrpt/bigross/ /usr/bin/scp username@x.x.x.x:/data/noaa/ross/'*.Z' /data/products/hrpt/ross/ /usr/bin/scp username@x.x.x.x:/data/noaa/mcmu/'*.Z' /data/products/hrpt/mcmu/ /usr/bin/scp username@x.x.x.x:/data/noaa/spole/'*.Z' /data/products/hrpt/southpole/ I want to incorporate something like ls -tr | tail -3, so I can get the last three files to date, instead of all. I don't mind changing the script to use ssh login first. Please advise. Thanks Ahead. TPR |
a loop?
Not sure I grasp what you want to do, but a loop should work. I can't think of a way to lump all the filenames into one command, so this would require either RSA key login, or a password entry each time.
for FILE in `ls -tr | tail -3` do scp user@host /path/$FILE . done Or you could look into using rsync, which copies only updated files and can use ssh as the connect protocol. |
All times are GMT -5. The time now is 10:30 AM. |