Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Rename a Folder
Message
 
À
20/12/2001 07:46:13
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
00596676
Message ID:
00596712
Vues:
33
>I would like to rename a folder. The command 'RENAME' doesn't work. I would also like to prevent the use of an AktiveX. Any idea how to do it?

There's two easy ways. First, there's the API
FUNCTION RenDir
  * AUTHOR: George Tasker
  * DATE: July 2, 1998 - 1:38 PM
  * PURPOSE: Renames a directory

  LPARAMETERS tcoldname, tcnewname

  DECLARE INTEGER MoveFile IN Win32API;
     STRING @lpcurrentname, STRING @lpnewname
  LOCAL lcoldname, lcnewname, llresult
  lcoldname = tcoldname
  lcnewname = Tcnewname
  llresult = (MoveFile(@lcoldname, @lcnewname) # 0)
  RETURN llresult
ENDFUNC
Second, as Hilmar mentioned there's the Windows Script Host
oFSO = CREATEOBJECT("Scripting.FileSystemObject")
* lcpath is the fully qualified file name
oFolder = oFSO.GetFolder(lcpath)
* lcnewname is the name of the new folder
oFolder.Name = lcnewname
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