For loop to rsync some files

Copy over each file beginning blegga containing number between 516 to 524 and ending with avi

for (( i = 516; i < 525; i++)); do rsync -P blegga*$i*.avi moo:foo/; done

Here’s an alternative way, using either the seq command (on GNU-based systems like Linux) or else the jot command (on BSD-based systems like Darwin / MacOSX)…

seq (on most GNU systems)

for i in `seq 516 524` ; do rsync -P blegga*${i}*.avi moo:foo/ ; done

jot (on most BSD systems)

for i in `jot – 516 524` ; do rsync -P blegga*${i}*.avi moo:foo/ ; done

*name

*e-mail

web site

leave a comment