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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VFP 7.0 Remove directory and subdirectory 2

Status
Not open for further replies.

bettyfurr

Technical User
Mar 12, 2002
371
US
I want to remove a directory/folder that contains subdirectory/folder with files. The RMDIR works if I erase the files and the folder is empty.

Does anyone know a simplier way to handle this? Please don't suggest through explorer; I suggest that.

thanks for any suggestion,

Betty
 
Within the program code. I have a menu that allows the user to delete the project. The project has its separate tables/folders. I want to delete the files/folder created by the project.
 
Betty,
I got the following WSH example from George Tasker on the UT (slightly modified):
Code:
*:* DELTREE equivalent
* lcfolder is the path without terminating backslash

oFSO = CREATEOBJECT('Scripting.FileSystemObject')
oFSO.DeleteFolder(lcfolder, .T.) && .T. -> Read-only files are deleted without an error
oFSO = .null.
Rick
 
Would it be possible to use the DOS command?

run deltree /y "drive + directory"
 
GUYS, explain more please, make it simple.

What is the scripting?

oFSO = CREATEOBJECT('Scripting.FileSystemObject')
oFSO.DeleteFolder(lcfolder, .T.) && .T. -> Read-only files are deleted without an error
oFSO = .null.

 
Starting with Win98 MS has included scripting (Windows Script Host - WSH) with it's operating systems to provide more access than the traditional .BAT files could offer.

While some "viruses" have been disguised as .VBS or .JS files, even if the administrator has shut off to these script files, the underlying "engine" is still there for use in legitamate applications. Note: Win 95 and NT systems may need to have WSH installed. For the addons and more info, go to
Rick
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top