Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Rename a folder
Message
 
 
To
04/08/2008 17:04:33
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Environment versions
Visual FoxPro:
VFP 8
OS:
Windows XP SP2
Network:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01336371
Message ID:
01336502
Views:
19
>How can we programably rename a folder in vfp8?

You can use MoveFile Win API or WSH
lcOldFolder = "h:\tmp\testdir"
lcNewFolderName = "TestDirNew"

* Win API
DECLARE Long  MoveFile IN WIN32API ;
	String SourceFileName, String DestFileName
IF MoveFile(lcOldFolderName, lcNewFolderName) = 0
  * Rename unsuccessful
  ...
ENDIF

* WSH
oFSO = CreateObject("Scripting.FileSystemObject")
oFolder = oFso.Getfolder(lcOldFolderName)
oFolder.Name = lcNewFolderName
--sb--
Previous
Reply
Map
View

Click here to load this message in the networking platform