Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Rename a Folder
Message
 
To
20/12/2001 07:46:13
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00596676
Message ID:
00596712
Views:
32
>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
Previous
Reply
Map
View

Click here to load this message in the networking platform