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

Create a directory if it doesn't exist 1

Status
Not open for further replies.

Mrall

Programmer
Nov 22, 2008
64
US
I normally use the getdir() command to locate the directory the user wants to store pictures in. However, I would like to allow the user to create the directory if it doesn't exist. How do I go about doing this like a getdir()command. where you right click to create a new folder.

Thanks
 
if not Directory("C:\SomeDir")
MD C:\someDir
endif

Ali Koumaiha
Wireless Toyz
Farmington Hills, Michigan
 
If you use VFP9 or VFP8 there is a new parameter named nFlags in GETDIR(). Just set it to 64 (check HELP for more info) and Make New Folder button will be there:
Code:
? GETDIR([],[],[],64)

Borislav Borissov
VFP9 SP2, SQL Server 2000/2005.
 
I have vfp6.0. Having vfp9 sure would make things easier. That is not an option at this time though. Do you know anyone who has coded a routine simular to a getdir() that places a make new folder option? Can the vfp9.0 getdir() function be rewritten as a new function for any previous verisions of vfp?

Thanks
 
Hi Mrall,

Even in VFP 6.0, you can make a direct call to Windows' own "Select Directory" dialogue (which is all that GETDIR() does).

Check the Windows API function, SHBrowseForFolder(). You can find the documentation for it on MSN or at ww.news2news.com

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top