Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Rename Directories
Message
 
To
11/09/2002 15:49:55
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00699499
Message ID:
00699519
Views:
16
>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
Previous
Reply
Map
View

Click here to load this message in the networking platform