Click here to Skip to main content
15,903,033 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have a batchfile and i'm using xcopy

i'm giving it a task to do, is copying files from a list

of files, but the name of the folders and files have special characters

like áéíóú... so if i execute to copy a file that has the name of creemebrule.jpg it works, but if i tell to copy creemebrulé.jpg it wont do it, it keeps saying that "file not found" when is there, so i did find out that xcopy does not support characters that are not regular...

i can't be screwing around with the name of the files and folders because they are set to be read for texture and are required the way the are, so this is my batch file:

@echo off
for /f "delims=" %%i in (filelist.txt) do echo F|xcopy "c:\%%i" "c:\prueba2%%i" /i /z /y

and this is the content of my filelist.txt file:

\prueba\foto\naranjas.rar
\prueba\foto2\naranjas4.rar
\prueba\célular\célulargenial.bmp (note: this is the one that fails because of the char "é")


i've been looking for a solution everywhere and i found the code, i just need support for special characters, is putting me in the ground :/
Posted

Funny stuff. First, I don't know such thing as "special character". Special for what? There is nothing "special" about this character, this is not even Unicode, just upper half of ANSI. What's funny, it's copied from the "copy" command using CMD.EXE shell, only batch file does not support it. (By the way, CMD.EXE application can work with Unicode, needs a command line parameter for that.) But batch file interpret this character as '8'.

Batch files are very old but they were re-worked in NT (even supports functions, in a rudimentary syntax), but perhaps some obsolescent "features" about file naming were not fixed. I don't think you can do anything about it.

—SA
 
Share this answer
 
Comments
atomiq005 27-Jun-11 17:59pm    
thanks.
Sergey Alexandrovich Kryukov 27-Jun-11 22:11pm    
You're welcome. Get serious, write some real code it batch betray you.
Will you accept this answer formally (green button)?
--SA
atomiq005 28-Jun-11 15:05pm    
ok i did it, just changed folder names like "À¯ÀúÀÎÅÍÆäÀ̽º" to a number, and in the text file changed the folder names to a number using massive text replacemento with NOTEPAD++, so when i copied all of them in one shot it didnt bring any problems of file not found, i there where a couple of files that had weird characters that i had to move manually, but they were minimal, overall it wasnt that much work, i hope i never have to do something like this again, in my spare times i'll be reading stuff so i dont get cought off gard haha
Sergey Alexandrovich Kryukov 28-Jun-11 19:32pm    
Agree with you. I also use two languages and English is not my native, and I know that Unicode is well supported for file systems. Nevertheless, you cannot say this is the case for all applications. To stay away from trouble, I never allow myself touching file system and code with any language other than English. I don't even use blank space in file names, even though it is supported -- it creates some extra hassles. I do it only for testing software I create. If you could follow this, you would probably never get into this kind of trouble again.

Thanks for accepting this answer.
Good luck, call again.
--SA
You're a programmer - write yourself a little console application program that takes two parameters - a source file and a target file - and use File.Copy to copy the file.

Call your console app from the batch file instead of xcopy.

It ain't rocket surgery.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900