IF ! FILE(cNewLongName)
RENAME (cOldName) TO (cNewLongName)
ELSE
* You can't rename a file to the same name used by another file
* or for that matter, to it's own name. reference to a file
* by short name does not make its long name available for rename
ENDIF
If you're trying to rename a file to have an LFN where LFNs are not supported (eg an older Novell NetWare file server that does not support LFNs) you'll get a similar error. Win95/98/NT will not assign multiple LFNs to the same short name, so unless LFNs aren't supported, or the name exists, the error should not occur.
Finally, you need to encapsulate the names of the variables in parens to make sure that the file names contained in the variables are referenced, not files with the names of the variables. Take a look at the RENAME syntax; you'll see that it expects names, not strings, as arguments to the RENAME.
>
>(where cOldName = 123456~1.abc, cNewLongName = 1234567890123.abc)
>
>However, VFP returned an error saying file name already exist. Apparently, cNewLongName is being changed to DOS 8.3 format (which resulted in cOldName) before the RENAME is carried out. Does anybody know the workaround?
>
>Thanks,
>juanEMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater
NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC
The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys