#! /usr/bin/perl # move-to-disks -- move files to floppy disk, not exceeding max size # 1 to erase the disk before the copy $do_delete_first = 1; $i = 0; opendir D, "." or die; for $f (sort readdir D) { $f =~ /\.zip/ or next; $size = (stat $f)[7]; $tot += $size; if ($tot > 1457664) { ++$i; $tot = $size; } push(@{ $list[$i] }, $f); } @drives = ( 'a', 'b' ); for $all (@list) { my @ll = @{ $all }; ($do_delete_first) and $cmd = "mcopy /dev/null $drives[0]:.xx && mdel $drives[0]:\* && "; $cmd .= "mcopy @ll $drives[0]: && rm -f @ll"; print "$cmd\n"; system("$cmd"); ## this to keep rolling thru drives: a b a b a b ... # push @drives, shift @drives; ## this to execute only once per drive: a b exit shift @drives; @drives or last; } ## 981227