<?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: See all files (not folders) exists in path in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/See-all-files-not-folders-exists-in-path/m-p/782897#M249586</link>
    <description>&lt;P&gt;If you'd like to do this recursively, you can try this macro:&amp;nbsp;&amp;nbsp;&lt;A href="https://core.sasjs.io/mp__dirlist_8sas.html" target="_blank"&gt;https://core.sasjs.io/mp__dirlist_8sas.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Usage:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%mp_dirlist(path=/some/location, outds=myTable, maxdepth=MAX)

data work.results;
  set work.mytable;
  where file_or_folder='file';
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 29 Nov 2021 12:33:49 GMT</pubDate>
    <dc:creator>AllanBowe</dc:creator>
    <dc:date>2021-11-29T12:33:49Z</dc:date>
    <item>
      <title>See all files (not folders) exists in path</title>
      <link>https://communities.sas.com/t5/SAS-Programming/See-all-files-not-folders-exists-in-path/m-p/782215#M249373</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;What is the way to ask see all files exists in a path (I dont want to get also folder exists ).&lt;/P&gt;
&lt;P&gt;This querty show files and folders and I want to get only files&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
rc=filename('xx',"/usr/local/SAS/SASUsers/LabRet/UserDir/RRR/");
did=dopen('xx');
do i=1 to dnum(did);
 fname=dread(did,i);
 output;
end;
rc=dclose(did);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 24 Nov 2021 13:19:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/See-all-files-not-folders-exists-in-path/m-p/782215#M249373</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2021-11-24T13:19:29Z</dc:date>
    </item>
    <item>
      <title>Re: See all files (not folders) exists in path</title>
      <link>https://communities.sas.com/t5/SAS-Programming/See-all-files-not-folders-exists-in-path/m-p/782225#M249375</link>
      <description>&lt;P&gt;Just try to open the file with DOPEN() to tell if it is a directory or not.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let path=~/;
data have;
  rc=filename('xx',"&amp;amp;path.");
  did=dopen('xx');
  if did then do i=1 to dnum(did);
    fname=dread(did,i);
    rc2=filename('yy',cats("&amp;amp;path.",fname));
    did2=dopen('yy');
    if did2 then rc2=dclose(did2);
    else output;
  end;
  rc=dclose(did);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 24 Nov 2021 14:20:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/See-all-files-not-folders-exists-in-path/m-p/782225#M249375</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-11-24T14:20:33Z</dc:date>
    </item>
    <item>
      <title>Re: See all files (not folders) exists in path</title>
      <link>https://communities.sas.com/t5/SAS-Programming/See-all-files-not-folders-exists-in-path/m-p/782423#M249422</link>
      <description>&lt;P&gt;Tom has already given you answer.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
rc=filename('xx',"c:\temp\");
did=dopen('xx');
do i=1 to dnum(did);
 fname=dread(did,i);

 flag=0;
 rc=filename('temp',"c:\temp\"||strip(fname));
 d=dopen('temp');
 if d then do;flag=1;rc=dclose(d);end;


 output;
end;
rc=dclose(did);
drop rc did i d;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 25 Nov 2021 12:11:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/See-all-files-not-folders-exists-in-path/m-p/782423#M249422</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2021-11-25T12:11:39Z</dc:date>
    </item>
    <item>
      <title>Re: See all files (not folders) exists in path</title>
      <link>https://communities.sas.com/t5/SAS-Programming/See-all-files-not-folders-exists-in-path/m-p/782897#M249586</link>
      <description>&lt;P&gt;If you'd like to do this recursively, you can try this macro:&amp;nbsp;&amp;nbsp;&lt;A href="https://core.sasjs.io/mp__dirlist_8sas.html" target="_blank"&gt;https://core.sasjs.io/mp__dirlist_8sas.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Usage:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%mp_dirlist(path=/some/location, outds=myTable, maxdepth=MAX)

data work.results;
  set work.mytable;
  where file_or_folder='file';
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 29 Nov 2021 12:33:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/See-all-files-not-folders-exists-in-path/m-p/782897#M249586</guid>
      <dc:creator>AllanBowe</dc:creator>
      <dc:date>2021-11-29T12:33:49Z</dc:date>
    </item>
  </channel>
</rss>

