As pending files (and previously uploaded files) counts get over a few hundred, counting the files becomes very slow. See also: https://forum.arduino.cc/t/very-slow-enum-files-with-sd-library/569492/4