Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Rename Directories
Message
 
À
11/09/2002 15:49:55
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00699499
Message ID:
00699519
Vues:
14
>Is there a Command or a API function to rename directories ?
>
Silvio,

You could use the Windows Script Host's Scripting.FileSystemObject.
oFSO = CREATEOBJECT("Scripting.FileSystemObject")
* lcfolder is the folder to change the name of
oFolder = oFSO.GetFolder(lcfolder)
oFolder.Name = "NewName"
Otherwise, you'd have to use the MoveFile() API call. Here's a funciton I wrote a few years ago to do this
* FUNCTION RenDir.prg
* AUTHOR: George Tasker
* DATE: July 2, 1998 - 1:38 PM
* PURPOSE: Renames a directory

LPARAMETERS pcoldname, pcnewname

DECLARE SHORT MoveFile IN Win32API;
   STRING @lpcurrentname, STRING @lpnewname
LOCAL lcoldname, lcnewname, llresult
lcoldname = pcoldname
lcnewname = pcnewname
llresult = (MoveFile(@lcoldname, @lcnewname) # 0)
RETURN llresult
George

Ubi caritas et amor, deus ibi est
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform