Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Renaming Dir
Message
 
To
21/05/2001 10:28:20
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00509442
Message ID:
00509456
Views:
19
>Is there a way to rename a directory (ie simulate the right click->rename in win 95 98. Can it be done from inside VFP? can it be done in a the batch/icon file that calls up a VFP app?
>
>
>TIA
Christopher,

This can be done via the Windows Script Host (from either inside VFP or from a VBScript file, which is the Windows equivalent of an old style DOS batch file). Or it can be done via the Win32API call MoveFile(). Here's a sample of both
* Via the WSH
oFSO = CREATEOBJECT("Scripting.FileSystemObject")
oFolder = oFSO.GetFolder("C:\OldName")
oFolder.Name = "NewName"
* Via the API
DECLARE INTEGER MoveFile IN Win32API;
  STRING @lpcurrentname, STRING @lpnewname
lcOld = "C:\OldName"
lcNew = "C:\NewName"
llresult = (MoveFile(@lcOld, @lcNew) # 0)
George

Ubi caritas et amor, deus ibi est
Previous
Reply
Map
View

Click here to load this message in the networking platform