<?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 How to list all files from Folder/ subfolder in SAS online demand version in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-list-all-files-from-Folder-subfolder-in-SAS-online-demand/m-p/805807#M317430</link>
    <description>&lt;P&gt;Hi, I am new SAS user. I am using SAS online demand version. I would like list all files from folder/subfolder. I tried below code but am neither am getting output nor error. Could you please help me&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;data yfiles;
 keep filename;
 length fref $8 filename $80;
 rc = filename(fref, 'path of folder/subfolder');
 if rc = 0 then
 do;
 did = dopen(fref);
 rc = filename(fref);
 end;
 else
 do;
 length msg $200.;
 msg = sysmsg();
 put msg=;
 did = .;
 end;
 if did &amp;lt;= 0
 then
 putlog 'ERR' 'OR: Unable to open directory.';
 dnum = dnum(did);
 do i = 1 to dnum;
 filename = dread(did, i);
 /* If this entry is a file, then output. */
 fid = mopen(did, filename);
 if fid &amp;gt; 0
 then
 output;
 end;
 rc = dclose(did);
 run;
 proc print data=yfiles;
 run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 04 Apr 2022 08:54:58 GMT</pubDate>
    <dc:creator>SASCODERS</dc:creator>
    <dc:date>2022-04-04T08:54:58Z</dc:date>
    <item>
      <title>How to list all files from Folder/ subfolder in SAS online demand version</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-list-all-files-from-Folder-subfolder-in-SAS-online-demand/m-p/805807#M317430</link>
      <description>&lt;P&gt;Hi, I am new SAS user. I am using SAS online demand version. I would like list all files from folder/subfolder. I tried below code but am neither am getting output nor error. Could you please help me&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;data yfiles;
 keep filename;
 length fref $8 filename $80;
 rc = filename(fref, 'path of folder/subfolder');
 if rc = 0 then
 do;
 did = dopen(fref);
 rc = filename(fref);
 end;
 else
 do;
 length msg $200.;
 msg = sysmsg();
 put msg=;
 did = .;
 end;
 if did &amp;lt;= 0
 then
 putlog 'ERR' 'OR: Unable to open directory.';
 dnum = dnum(did);
 do i = 1 to dnum;
 filename = dread(did, i);
 /* If this entry is a file, then output. */
 fid = mopen(did, filename);
 if fid &amp;gt; 0
 then
 output;
 end;
 rc = dclose(did);
 run;
 proc print data=yfiles;
 run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 04 Apr 2022 08:54:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-list-all-files-from-Folder-subfolder-in-SAS-online-demand/m-p/805807#M317430</guid>
      <dc:creator>SASCODERS</dc:creator>
      <dc:date>2022-04-04T08:54:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to list all files from Folder/ subfolder in SAS online demand version</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-list-all-files-from-Folder-subfolder-in-SAS-online-demand/m-p/805808#M317431</link>
      <description>&lt;P&gt;I tried your code in SAS OnDemand for Academics and it outputs a file list.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="japelin_0-1649063766665.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/70091i80823D1F9D1E9C02/image-size/medium?v=v2&amp;amp;px=400" role="button" title="japelin_0-1649063766665.png" alt="japelin_0-1649063766665.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Are you specifying the directory path correctly?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;  rc = filename(fref, '/home/myusername/');/* specify "path of folder/subfolder" */&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It is strange that you get no results at all, so please paste the log after submitting.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Apr 2022 09:16:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-list-all-files-from-Folder-subfolder-in-SAS-online-demand/m-p/805808#M317431</guid>
      <dc:creator>japelin</dc:creator>
      <dc:date>2022-04-04T09:16:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to list all files from Folder/ subfolder in SAS online demand version</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-list-all-files-from-Folder-subfolder-in-SAS-online-demand/m-p/805810#M317432</link>
      <description>&lt;P&gt;At the end of path I didn't give the "/" previously. That's why i didn't get the output. Now am getting output. Thank you.&lt;/P&gt;</description>
      <pubDate>Mon, 04 Apr 2022 09:21:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-list-all-files-from-Folder-subfolder-in-SAS-online-demand/m-p/805810#M317432</guid>
      <dc:creator>SASCODERS</dc:creator>
      <dc:date>2022-04-04T09:21:38Z</dc:date>
    </item>
  </channel>
</rss>

