<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to check if a folder is empty in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-check-if-a-folder-is-empty/m-p/393827#M94883</link>
    <description>&lt;P&gt;This should work&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro isemptyfolder(folder);

	%let filrf=mydir;
	%let rc=%sysfunc(filename(filrf, "&amp;amp;folder"));
	%let did=%sysfunc(dopen(&amp;amp;filrf));
	%let memcount=%sysfunc(dnum(&amp;amp;did));
	%let rc=%sysfunc(dclose(&amp;amp;did));
	%put 'number of members in folder ' &amp;amp;folder ' = ' &amp;amp;memcount;

%mend isemptyfolder;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 07 Sep 2017 10:51:09 GMT</pubDate>
    <dc:creator>ChrisBrooks</dc:creator>
    <dc:date>2017-09-07T10:51:09Z</dc:date>
    <item>
      <title>How to check if a folder is empty</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-check-if-a-folder-is-empty/m-p/393817#M94880</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I need the code to check whether the directory is empty in sas macro.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Sep 2017 10:34:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-check-if-a-folder-is-empty/m-p/393817#M94880</guid>
      <dc:creator>Arjumand</dc:creator>
      <dc:date>2017-09-07T10:34:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to check if a folder is empty</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-check-if-a-folder-is-empty/m-p/393822#M94882</link>
      <description>&lt;P&gt;Please note this is a Q&amp;amp;A board, not a contract work request system. &amp;nbsp;If you have a question, provide what you have done, show example code using the {i}. &amp;nbsp;If you have access to the command line then doing a filename tmp pipe 'dir c:\test /b'; and using that in a datastep then checking that might work. &amp;nbsp;Not sure what the benefit of checking for an empty directory is though, doesn't really add anything. &amp;nbsp;Do you want to check existence of the folder, or maybe a file you don't want to overwrite?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Sep 2017 10:40:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-check-if-a-folder-is-empty/m-p/393822#M94882</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-09-07T10:40:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to check if a folder is empty</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-check-if-a-folder-is-empty/m-p/393827#M94883</link>
      <description>&lt;P&gt;This should work&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro isemptyfolder(folder);

	%let filrf=mydir;
	%let rc=%sysfunc(filename(filrf, "&amp;amp;folder"));
	%let did=%sysfunc(dopen(&amp;amp;filrf));
	%let memcount=%sysfunc(dnum(&amp;amp;did));
	%let rc=%sysfunc(dclose(&amp;amp;did));
	%put 'number of members in folder ' &amp;amp;folder ' = ' &amp;amp;memcount;

%mend isemptyfolder;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 07 Sep 2017 10:51:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-check-if-a-folder-is-empty/m-p/393827#M94883</guid>
      <dc:creator>ChrisBrooks</dc:creator>
      <dc:date>2017-09-07T10:51:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to check if a folder is empty</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-check-if-a-folder-is-empty/m-p/393840#M94884</link>
      <description>Hi &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/45151"&gt;@RW9&lt;/a&gt;: Thanks for your reply. Just for the info, I am not actually doing any project but making myself more familiar with macro programming. I was actually writing a UNIX shell script which had certain validations and thought for the same in SAS.&lt;BR /&gt;</description>
      <pubDate>Thu, 07 Sep 2017 11:57:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-check-if-a-folder-is-empty/m-p/393840#M94884</guid>
      <dc:creator>Arjumand</dc:creator>
      <dc:date>2017-09-07T11:57:49Z</dc:date>
    </item>
  </channel>
</rss>

