Problem is that I cannot figured out how to count only "successful" attempts of move files.
My script take directories from $PATH as destination and tries to take files from specified directory (until the directory is empty) , shuffle them in random order and move to directories from $PATH.
x=0
while [[ $(ls -A Directory/jpg | wc -l) -gt 0 ]]
do
for i in "${destination[@]}"
do
shuf -zn1 -e Directory/jpg/*.jpg | xargs -0 mv -vt $i/somedir 2>/dev/null
x=$((x + 1))
done
done
My "x" counter is actually greater then number of files that were in "Directory/jpg" and I would like to "x" represent only exact numbers of files that were copied.