I have complicated things a bit by storing all the files in a directory containing spaces in name, "my test".
I also set two files named:
- "non utf-8.txt"
- "utf8.txt"
Without quotes in the loop, Iget the following log:
Code:
Iterate through files and convert them to UTF-8
/home/admius/Downloads/my
/home/admius/Downloads/my is not UTF-8 encoded (found binary)
Convert to UTF-8
test/non
test/non is not UTF-8 encoded (found )
Convert to UTF-8
utf-8.txt
utf-8.txt is not UTF-8 encoded (found )
Convert to UTF-8
/home/admius/Downloads/my
/home/admius/Downloads/my is not UTF-8 encoded (found binary)
Convert to UTF-8
test/utf8.txt
test/utf8.txt is not UTF-8 encoded (found )
Convert to UTF-8
It creates an empty new file, named "utf-8.txt".
And it does not correct the non UTF-8 file, as it works with wrong paths, obviously.
I don't care how, or if it is following the above code at all, is this even possible, i.e. selecting some files and converting them when spaces are in the names of the files and their directory paths?