[AccessD] Does a directory exist?

Stuart McLachlan stuart at lexacorp.com.pg
Thu Jun 23 23:37:17 CDT 2011


Here ya go:

Function IsDir(pathname As String) As Boolean
If Len(Dir(pathname, vbDirectory)) Then
   If GetAttr(pathname) = vbDirectory Then
       IsDir = True
   End If
End If
End Function


On 24 Jun 2011 at 14:30, Stuart McLachlan wrote:

> That doesn't work. If there is a file called C:\Major, it still
> returns 8.
> 
> <quote>
> vbDirectory 16    Specifies directories or folders in addition to
> files with no attributes </Quote>
> 
> I'll try to dig out an IsDir() and post it.
> 
> -- 
> Stuart
> 
> On 24 Jun 2011 at 16:16, Steve Schapel wrote:
> 
> > Arthur
> > 
> > Len(Dir("C:\Major", vbDirectory))
> > 
> > And to the follow up question, I am pretty sure you have to do it in
> > 2 steps.
> > 
> > Regards
> > Steve
> > 
> > -----Original Message----- 
> > From: Arthur Fuller
> > Sent: Friday, June 24, 2011 4:02 PM
> > To: Access Developers discussion and problem solving
> > Subject: [AccessD] Does a directory exist?
> > 
> > I've been playing around with the Dir() function but I can't figure
> > out how to determine whether a directory exists, so I can create it
> > if it doesn't. Followup question: can I create a directory called
> > "C:\major\minor" if "C:\major" doesn't exist, or do I have to create
> > "C:\major" first and then create "C:\major\minor"?
> > 
> > TIA,
> > Arthur
> > 
> > -- 
> > 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