If I may humbly offer a suggestion, looping over filenames should [edit: almost] never be done with ls. find can be used with much better fidelity:
https://www.shellcheck.net/wiki/SC2012
"ls is only intended for human consumption: it has a loose, non-standard format and may "clean up" filenames to make output easier to read."