New answers tagged split
I'm not entirely sure I followed your rules completely, but it might be easier to use standard utilities (and simplify the rules for what and when to create): find . -type f | split -d -a3 -l $num --filter='zip -@ $FILE.zip' - "$pfx". find is rather obvious, tweak options to your liking. You might want to sort the list before passing its output to split. ...
Top 50 recent answers are included