ImageMagick complains when image is missing while stitching together tiles of an image I have to stitch together pictures (first vertically, then horizontally) with a varying amount of tiles via the command line on macOS 10.14.5. I usually use this command:

convert -append 0_0.jpeg 0_1.jpeg 0_2.jpeg 0_3.jpeg 0_4.jpeg 0_5.jpeg 0a.jpg &amp;&amp;
convert -append 1_0.jpeg 1_1.jpeg 1_2.jpeg 1_3.jpeg 1_4.jpeg 1_5.jpeg 1a.jpg &amp;&amp;
convert -append 2_0.jpeg 2_1.jpeg 2_2.jpeg 2_3.jpeg 2_4.jpeg 2_5.jpeg 2a.jpg &amp;&amp;
convert -append 3_0.jpeg 3_1.jpeg 3_2.jpeg 3_3.jpeg 3_4.jpeg 3_5.jpeg 3a.jpg &amp;&amp;
convert -append 4_0.jpeg 4_1.jpeg 4_2.jpeg 4_3.jpeg 4_4.jpeg 4_5.jpeg 4a.jpg &amp;&amp;
convert -append 5_0.jpeg 5_1.jpeg 5_2.jpeg 5_3.jpeg 5_4.jpeg 5_5.jpeg 5a.jpg &amp;&amp;
convert -append 6_0.jpeg 6_1.jpeg 6_2.jpeg 6_3.jpeg 6_4.jpeg 6_5.jpeg 6a.jpg &amp;&amp;
convert +append 0a.jpg 1a.jpg 2a.jpg 3a.jpg 4a.jpg 5a.jpg 6a.jpg 0_final.jpg


where I first add all corresponding tiles vertically (here 6 tiles) and then add all columns (here 7) horizontally to the final picture.

The issue is that sometimes, I have less pictures in a column (0 to 4 instead of 0 to 5 as given here) or more columns (0 to 10 instead of 0 to 6 as shown here).

Is it possible to adjust the above command so that imagemagick does not complain that, for example, picture 0_5.jpg or 7_0.jpg does not exist? Currently imagemagick complains and stops the process of stitching together the existing tiles.
You should be able to do this with wildcards. The shell will expand to existing files:

convert -append 0_*jpeg 0a.jpg &amp;&amp;
convert -append 1_*jpeg 1a.jpg &amp;&amp;
convert -append 2_*jpeg 2a.jpg &amp;&amp;
convert -append 3_*jpeg 3a.jpg &amp;&amp;
convert -append 4_*jpeg 4a.jpg &amp;&amp;
convert -append 5_*jpeg 5a.jpg &amp;&amp;
convert -append 6_*jpeg 6a.jpg &amp;&amp;
convert +append *a.jpg 0_final.jpg