Copy date stamped backups with a regex & scp
Lets assume you have a directory of date stamped backups you want to scp to another location…
backup_20141003.tar.gz
backup_20141004.tar.gz
backup_20141005.tar.gz
backup_20141006.tar.gz
backup_20141007.tar.gz
backup_20141008.tar.gz
backup_20141009.tar.gz
scp can accept a regex like below to do this as a one-liner. Note the quotes are required for the expression to work.
scp "user@hostname:/data/backup/backup_2014100[3-9].tar.gz" /path/to/location/
You should see something like this output…
backup_20141003.tar.gz 100% 22GB 55.5MB/s 06:43
backup_20141004.tar.gz 100% 22GB 12.0MB/s 31:13
backup_20141005.tar.gz 100% 22GB 12.3MB/s 30:41
backup_20141006.tar.gz 100% 22GB 7.5MB/s 49:52
backup_20141007.tar.gz 77% 17GB 38.7MB/s 02:12 ETA