[AccessD] Does a directory exist?

Arthur Fuller fuller.artful at gmail.com
Fri Jun 24 00:03:40 CDT 2011


Thanks!

Arthur

On Fri, Jun 24, 2011 at 12:48 AM, Stuart McLachlan
<stuart at lexacorp.com.pg>wrote:

> My first try didn't cover all contingencies.
>
> This one should work:
>
> Function IsDir(pathname As String) As Boolean
> If Len(Dir(pathname, vbDirectory + vbHidden + vbSystem + vbReadOnly)) Then
>   If GetAttr(pathname) And vbDirectory = vbDirectory Then
>        IsDir = True
>   End If
> End If
> End Function
>
> --
> Stuart
>
> On 24 Jun 2011 at 14:37, Stuart McLachlan wrote:
>
> > 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
> > >
> >
> >
> >
> > --
> > 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