Split files into multiple subfolders and zip each subfolder
Solution 1:
You can use a for-loop to get a fixed number of items. a
will increase with the number of c
and b
by every iteration.
#!/bin/bash
mapfile -td '' < <( \
find -maxdepth 1 -type f ! -name '*.zip' -print0 \
)
((${#MAPFILE} == 0)) && exit 1
for ((a=0, b=0, c=850; a<${#MAPFILE[@]}; a+=c, b++)); do
mkdir images$b && \
mv -t $_ "${MAPFILE[@]:$a:$c}" && zip -mTr images$b images$b
done