Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Renaming a directory
Message
De
21/07/2000 18:30:32
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00395201
Message ID:
00395755
Vues:
9
>>How can I rename a directory from inside VFP6? I suppose is via the API but don't know how to do it.
>
>Try using rename() from the C++ runtime:
>
>Declare Integer rename in MSVCRT.dll As _rename String @oldname, String @newname
>md c:\foo
>lsOld = "c:\foo"
>lsNew = "c:\newfoo"
>_rename(@lsOld, @lsNew)
>

Actually, you could omit it and either prefix it with an = (forcing it to be treated as a function call) or use it as a numeric expression (success returns 0) so the following work:
Declare Integer rename in MSVCRT.dll As rename String @oldname, String @newname
=rename(lsOld,lsNew)  && you can pass just strings and not variables since you dont need returns
IF rename(lsOld,lsNew) = 0
   *  it worked
ELSE
   * it didn't
ENDIF
>Note that you have to alias the function name because VFP already has a RENAME command.
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