Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: Visual Basic
Expertise: Intermediate
Sep 10, 1998

Easily Create All Directories in a Path

Use this code to create a tree of folders on Windows 95 or NT 4.0 in one line:
 Private Declare Function _
	MakeSureDirectoryPathExists Lib "IMAGEHLP.DLL" _
	(ByVal DirPath As String) As Long
Private Sub Command1_Click()
	Dim MyPath As String
	Dim bResult As Long
	'Specify the directory that we need
	MyPath = "C:\Win95\Temp\MyFolder\" & _
		"MyFolder\Fld1\Fld2\"
	'Now create that directory if it does exist. 
	'The entire path will be created if needed 
	bResult = MakeSureDirectoryPathExists(MyPath)
	'Test for failure
	If bResult = 0 Then
		MsgBox "MakeSureDirectoryPathExists failed!"
	End If
End Sub
Mordechai Eli
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date