<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Directory Exists</title>
	<atom:link href="http://www.dailydoseofexcel.com/archives/2005/05/31/directory-exists/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dailydoseofexcel.com/archives/2005/05/31/directory-exists/</link>
	<description>Daily posts of Excel tips…and other stuff</description>
	<lastBuildDate>Wed, 08 Feb 2012 23:58:05 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Jon Peltier</title>
		<link>http://www.dailydoseofexcel.com/archives/2005/05/31/directory-exists/#comment-12716</link>
		<dc:creator>Jon Peltier</dc:creator>
		<pubDate>Wed, 01 Jun 2005 03:08:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1149#comment-12716</guid>
		<description>&lt;p&gt;For FileExists, I use the following, which I swiped from a post by Karl Peterson, VB MVP (FileSpec is the full file and path name):&lt;/p&gt;
&lt;p&gt;Function FileExists(ByVal FileSpec As String) As Boolean&lt;br&gt;
  &#039; Karl Peterson MS VB MVP&lt;br&gt;
  Dim Attr As Long&lt;br&gt;
  &#039; Guard against bad FileSpec by ignoring errors&lt;br&gt;
  &#039; retrieving its attributes.&lt;br&gt;
  On Error Resume Next&lt;br&gt;
  Attr = GetAttr(FileSpec)&lt;br&gt;
  If Err.Number = 0 Then&lt;br&gt;
    &#039; No error, so something was found.&lt;br&gt;
    &#039; If Directory attribute set, then not a file.&lt;br&gt;
    FileExists = Not ((Attr And vbDirectory) = vbDirectory)&lt;br&gt;
  End If&lt;br&gt;
End Function&lt;/p&gt;
&lt;p&gt;I tweaked it a little (all by myself!) for DirExists:&lt;/p&gt;
&lt;p&gt;Function DirExists(ByVal FileSpec As String) As Boolean&lt;br&gt;
  &#039; Karl Peterson MS VB MVP&lt;br&gt;
  Dim Attr As Long&lt;br&gt;
  &#039; Guard against bad FileSpec by ignoring errors&lt;br&gt;
  &#039; retrieving its attributes.&lt;br&gt;
  On Error Resume Next&lt;br&gt;
  Attr = GetAttr(FileSpec)&lt;br&gt;
  If Err.Number = 0 Then&lt;br&gt;
    &#039; No error, so something was found.&lt;br&gt;
    &#039; If Directory attribute set, then not a file.&lt;br&gt;
    DirExists = (Attr And vbDirectory) = vbDirectory&lt;br&gt;
  End If&lt;br&gt;
End Function&lt;/p&gt;
&lt;p&gt;I haven&#039;t come across the need for DirEmpty. It seems I&#039;d want to know the difference between a directory being empty and not existing at all, so I&#039;d probably use DirExists, then do Dir$ on *.* within the path.&lt;/p&gt;
&lt;p&gt;- Jon&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>For FileExists, I use the following, which I swiped from a post by Karl Peterson, VB MVP (FileSpec is the full file and path name):</p>
<p>Function FileExists(ByVal FileSpec As String) As Boolean<br />
  &#8216; Karl Peterson MS VB MVP<br />
  Dim Attr As Long<br />
  &#8216; Guard against bad FileSpec by ignoring errors<br />
  &#8216; retrieving its attributes.<br />
  On Error Resume Next<br />
  Attr = GetAttr(FileSpec)<br />
  If Err.Number = 0 Then<br />
    &#8216; No error, so something was found.<br />
    &#8216; If Directory attribute set, then not a file.<br />
    FileExists = Not ((Attr And vbDirectory) = vbDirectory)<br />
  End If<br />
End Function</p>
<p>I tweaked it a little (all by myself!) for DirExists:</p>
<p>Function DirExists(ByVal FileSpec As String) As Boolean<br />
  &#8216; Karl Peterson MS VB MVP<br />
  Dim Attr As Long<br />
  &#8216; Guard against bad FileSpec by ignoring errors<br />
  &#8216; retrieving its attributes.<br />
  On Error Resume Next<br />
  Attr = GetAttr(FileSpec)<br />
  If Err.Number = 0 Then<br />
    &#8216; No error, so something was found.<br />
    &#8216; If Directory attribute set, then not a file.<br />
    DirExists = (Attr And vbDirectory) = vbDirectory<br />
  End If<br />
End Function</p>
<p>I haven&#8217;t come across the need for DirEmpty. It seems I&#8217;d want to know the difference between a directory being empty and not existing at all, so I&#8217;d probably use DirExists, then do Dir$ on *.* within the path.</p>
<p>- Jon</p>
]]></content:encoded>
	</item>
</channel>
</rss>

