[AccessD] Creating SubDirectories

Max Wanadoo max.wanadoo at gmail.com
Sat Oct 18 13:27:02 CDT 2008


Hi,
I have no code to hand, but what I do is just create the drive I want (use
code to move up and down my drive structure, regardless of what is actually
there) and just create it using  a FS object (File scripting object).
If it already exists, just trap the error and move on.
If you are still struggling on Monday when I get back to work, I will send
the code.

Max


-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Dan Waters
Sent: 18 October 2008 18:30
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] Creating SubDirectories

How about:

Dim fso As Object

Set fso = CreateObject("Scripting.FileSystemObject")

If fso.FolderExists("C:\One\") = False Then
	fso.CreateFolder ("C:\One\Two\Three\")
Else
	If fso.FolderExists("C:\One\Two") = False Then
		fso.CreateFolder ("C:\One\Two\Three\")
	Else
		If fso.FolderExists("C:\One\Two\Three") = False Then
			fso.CreateFolder("C:\One\Two\Three\")
		End If
	End If
End If

fso.close

Dan

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Tony Septav
Sent: Saturday, October 18, 2008 11:14 AM
To: Access Developers discussion and problem solving
Subject: [AccessD] Creating SubDirectories

Hey All
I am wanting to allow the user to indicate a path (for file storage).
The program checks to see if the path exists, if not it notifies the 
user that the path doesn't exist and would they like the program to 
create it.
I can do this, but rather then reinventing the wheel does anyone know of 
a custom function that would loop through the path and create the 
necessary folders/directories.
Eg.
C:\One\Two\Three
Directory One doesn't exist so create the full path.
Directory One and Two do exist so create folder Three

-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com

-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com




More information about the AccessD mailing list