Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

creating, and copying directory plus contents in VFP 7.0?

Status
Not open for further replies.

bettyfurr

Technical User
Joined
Mar 12, 2002
Messages
371
Location
US
Are there any code for copying directory plus contents in VFP 7.0?

I can create a program that append into a dbf and copy files with wild cards but do not how to create and copy directories. Is this possible?
 
There is a very good COM-object available from Microsoft. The name is the Microsoft Scripting Runtime and can be found in the directory c:\windows\system\scrrun.dll look it over with your VFP7 object browser. Works very well.

Charl
 
Explicit examples of the WSH technique follows:

*:* Copy Directory/Folder

ofs=createobject("scripting.filesystemobject")
ofs.copyfolder('c:\foldername','c:\newfoldername')


*:* Copy Files

* lcfiles is a file name with or without wildcards
* lcdir is the target directory
oShell = CREATEOBJECT('Shell.Application')
oFolder = oShell.Application.Namespace(lcdir)
oFolder.CopyHere(lcfiles)

Additionally, you can specify parameters that control how the dialog operates for example pass FOF_NOCONFIRMATION (0x10) so that a confirmation dialog doesn't appear if a file with the same name exists in the target directory. The constants are mentioned in SHFILEOPSTRUCT topic and the values can be found in Shlobj.h in the VC++ Include sub-directory.

Rick
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top