rianeiromiron
Programmer
Hi all!!!
I have several files in several directories which, for some uknow reason were copied from a digital camera (through USB or whatever. So, the problem is some of the files have "invalid" names, which contains characters such as chr(8), chr(9) and so. If I copy those files manually, Windows can handle them just fine. But when I use the methods of copy in VFP known to me (COPY FILE) or those from WinApi, I allways get error messages. Here is an example of the methods I'v used, with no success
*!* Method 1.
*!* ParentFolder = "C:\Copia2"
*!* oShell = CreateObject("Shell.Application")
*!* oFolder = oShell.NameSpace(ParentFolder)
*!* oFolder.CopyHere("C:\Copia1\"+chr(11)+".XLS")
*fs = CreateObject("Scripting.FileSystemObject")
*fs.CopyFile("C:\Copia1\"+chr(11)+".XLS","C:\Copia2\"+chr(11)+".XLS",.T.) && The last parameter is for overwriting.
*COPY FILE GETFILE() TO "C:\Copia2\"+chr(11)+".XLS"
*!* FUNCTION TRYCOPY( OrigDir, NewDir )
*!* DECLARE INTEGER MoveFile IN WIN32API AS apiMoveFile STRING lpExistingFileName, STRING lpNewFileName
*!* RETURN 0<>apiMoveFile( OrigDir, NewDir )
*!* ENDFUNC
*!* I called the above function like this
*!* =TRYCOPY("C:\Copia1\"+chr(11)+".XLS","C:\Copia2\"+chr(11)+".XLS")
In all of the examples above, chr(11) is the invalid character.
Any clues on dealing with that? I DO NEED to copy those files.
Thanks.
I have several files in several directories which, for some uknow reason were copied from a digital camera (through USB or whatever. So, the problem is some of the files have "invalid" names, which contains characters such as chr(8), chr(9) and so. If I copy those files manually, Windows can handle them just fine. But when I use the methods of copy in VFP known to me (COPY FILE) or those from WinApi, I allways get error messages. Here is an example of the methods I'v used, with no success
*!* Method 1.
*!* ParentFolder = "C:\Copia2"
*!* oShell = CreateObject("Shell.Application")
*!* oFolder = oShell.NameSpace(ParentFolder)
*!* oFolder.CopyHere("C:\Copia1\"+chr(11)+".XLS")
*fs = CreateObject("Scripting.FileSystemObject")
*fs.CopyFile("C:\Copia1\"+chr(11)+".XLS","C:\Copia2\"+chr(11)+".XLS",.T.) && The last parameter is for overwriting.
*COPY FILE GETFILE() TO "C:\Copia2\"+chr(11)+".XLS"
*!* FUNCTION TRYCOPY( OrigDir, NewDir )
*!* DECLARE INTEGER MoveFile IN WIN32API AS apiMoveFile STRING lpExistingFileName, STRING lpNewFileName
*!* RETURN 0<>apiMoveFile( OrigDir, NewDir )
*!* ENDFUNC
*!* I called the above function like this
*!* =TRYCOPY("C:\Copia1\"+chr(11)+".XLS","C:\Copia2\"+chr(11)+".XLS")
In all of the examples above, chr(11) is the invalid character.
Any clues on dealing with that? I DO NEED to copy those files.
Thanks.