i meet the same problem with RenameFile. Somehow when i loop through a folder, it can only rename one file and then pump up with the above error message. It turns out to be, that , the filename you got by FileNames uses single backslash that should be double backslash . So all you need to do is to replace "*" to "\" by using "\" to "\\*"backslash to double backslash. Then it works! Another wired thing is: if you manually copy one filename from the output of FileNames, all the ""single backslash in that name automatically turns into "\"double backslash. So it seems like when you put such name indirectly into a function, the program fails to make that conversion.