Filenames - do they contain unicode characters?
in your code, you load texture to memory
Is there a field behind the file names indicating the size of the files in bytesYes, the filenames are always 64 bytes long but not all of the bytes are always used.
Try converting these characters to spaces, then _TRIM $ will work for you and maybe it will help.
you take the filename from Texture().NAME, which is probably a fixed length string in your Texture UDT
I've made LStrip/RStrip functions in GuiTools (dev_framwork/GuiAppFrame.bm), which are much smarter than LTRIM/RTRIM and can handle the problem described above, just replace RTRIM with RStrip and use mode stripFIX.