Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to rename file to Long filename in VFP
Message
De
10/11/1998 01:25:14
 
 
À
10/11/1998 00:13:31
Juan Kh
Dataprop Technologies
Sungai Petani, Malaisie
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00156045
Message ID:
00156052
Vues:
47
>Hello,
>
>I tried to rename a file to another file name (long file name) with the following command:
>
>RENAME cOldName To cNewLongName

Try

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,
>juan
EMail: 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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform