Never script before nine
Jul. 22nd, 2009 08:18 pmHaving churned out a whole load of data over night on the mac, I wanted to shift the output files over to my NAS, where I've got more free disc space. So, first thing this morning and barely conscious, I threw the following nasty little fragment at the command line to do the heavy lifting:
for i in *.dat; do echo $i; scp $i nas:results/${i%%-run*}.dat; rm $i ; done
And sure enough, the machine started churning away and I went off to do something else. After a few minutes I came back and suddenly realised that I'd forgotten to switch the NAS box on, so all my transfers were timing out and the uncopied data was being trashed. Oops.
Next time I try this I'm going to: (a) make sure that I use an scp && rm
construct; (b) I'm going to make damn sure my destination box is on; and (c) I'm not going to try and do it when I'm both in a hurry and half-asleep...