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

Create Folder 1

Status
Not open for further replies.

shangrilla

Programmer
Nov 21, 2001
360
0
0
US
I want to check if a specific folder exists on the C:
If not I want to create that folder.

What commands do I have to use to do this.
 
******************

From Help DIRECTORY() to check for a drectory/folder:

DIRECTORY(cDirectoryName)

Returns true (.T.) if the specified directory is found on disk.

From Help MKDIR (Make Directory) how to create a diectory or folder:

SET DEFAULT TO HOME( ) && Restore Visual FoxPro directory
MKDIR mytstdir && Create a new directory
CHDIR mytstdir && Change to the new directory
= GETDIR( ) && Display the Select Directory dialog box
SET DEFAULT TO HOME( ) && Restore Visual FoxPro directory
RMDIR mytstdir && Remove the new directory
= GETDIR( ) && Display the Select Directory dialog box

Jack


 
HI

****************************
LOCAL myDir
myDir = "C:\DirectoryName"

IF ! DIRECTORY(myDire)
MD &myDir
ENDIF
&& DO WHATEVER YOU WANT
****************************
This is same as what jack has written, but more specific to your question. :)

ramani :-9
(Subramanian.G),FoxAcc, ramani_g@yahoo.com
 
Small typo error :-( (not myDire but myDir)
****************************
LOCAL myDir
myDir = "C:\DirectoryName"

IF ! DIRECTORY(myDir)
MD &myDir
ENDIF
&& DO WHATEVER YOU WANT
****************************
:) ramani :-9
(Subramanian.G),FoxAcc, ramani_g@yahoo.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top