<?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 extract file names from multiple folders in a drive in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/how-to-extract-file-names-from-multiple-folders-in-a-drive/m-p/397640#M96118</link>
    <description>&lt;P&gt;Here is another option.&lt;/P&gt;
&lt;P&gt;You may have to alter th&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
filename DIR pipe "dir ""c:\temp\*.sas"" /s/q " ;
data FILES;  
  infile DIR pad;
  input X $256.;    
  length PATH FILENAME $256;
  retain PATH ;
  if index(X,'Directory of') then PATH=substr(X,14);
  else if char(X,3)='/' and not index(X,'&amp;lt;DIR&amp;gt;') then do;
    TOPDIR  =catx('\',scan(PATH,1,'\'),scan(PATH,2,'\'),scan(PATH,3,'\'));  
    FILENAME=substr(X,65);
    DATE    =input(scan(X,1,' '),?? ddmmyy10.);
    SIZE    =input(scan(X,4,' '),?? comma20.);
    OWNER   =substr(X,42,23);
    output;
  end;
  format DATE date9. SIZE comma20.0;
  *drop X;
run;      &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;e way the line is parsed as Windows changes the file description line depending on its coonfiguration.&lt;/P&gt;</description>
    <pubDate>Wed, 20 Sep 2017 22:47:41 GMT</pubDate>
    <dc:creator>ChrisNZ</dc:creator>
    <dc:date>2017-09-20T22:47:41Z</dc:date>
    <item>
      <title>how to extract file names from multiple folders in a drive</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-extract-file-names-from-multiple-folders-in-a-drive/m-p/397608#M96110</link>
      <description>&lt;P&gt;Hi everyone.&lt;BR /&gt;I have a folder that contain mutiple text documents, placed in subfolders.&lt;BR /&gt;Is there a way of importing the file names of these files as a string into a dataset?&lt;BR /&gt;I have found some examples round the internet and in SAS community but they dont seem to be working.&lt;/P&gt;&lt;P&gt;Files are in .txt,.dat,.tx,.csv and&amp;nbsp;pgp format.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;</description>
      <pubDate>Wed, 20 Sep 2017 20:50:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-extract-file-names-from-multiple-folders-in-a-drive/m-p/397608#M96110</guid>
      <dc:creator>raju23</dc:creator>
      <dc:date>2017-09-20T20:50:19Z</dc:date>
    </item>
    <item>
      <title>Re: how to extract file names from multiple folders in a drive</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-extract-file-names-from-multiple-folders-in-a-drive/m-p/397609#M96111</link>
      <description>&lt;P&gt;There's lots of examples across the web as you've indicated.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's one that fully documented and that you can change as desired. You'll need to actually remove code because you don't care about the extension, but it should get you started.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This assumes you're on Windows and not in a lockdown system.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/mcrolref/69726/HTML/default/viewer.htm#n0js70lrkxo6uvn1fl4a5aafnlgt.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/mcrolref/69726/HTML/default/viewer.htm#n0js70lrkxo6uvn1fl4a5aafnlgt.htm&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Sep 2017 20:55:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-extract-file-names-from-multiple-folders-in-a-drive/m-p/397609#M96111</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-09-20T20:55:23Z</dc:date>
    </item>
    <item>
      <title>Re: how to extract file names from multiple folders in a drive</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-extract-file-names-from-multiple-folders-in-a-drive/m-p/397640#M96118</link>
      <description>&lt;P&gt;Here is another option.&lt;/P&gt;
&lt;P&gt;You may have to alter th&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
filename DIR pipe "dir ""c:\temp\*.sas"" /s/q " ;
data FILES;  
  infile DIR pad;
  input X $256.;    
  length PATH FILENAME $256;
  retain PATH ;
  if index(X,'Directory of') then PATH=substr(X,14);
  else if char(X,3)='/' and not index(X,'&amp;lt;DIR&amp;gt;') then do;
    TOPDIR  =catx('\',scan(PATH,1,'\'),scan(PATH,2,'\'),scan(PATH,3,'\'));  
    FILENAME=substr(X,65);
    DATE    =input(scan(X,1,' '),?? ddmmyy10.);
    SIZE    =input(scan(X,4,' '),?? comma20.);
    OWNER   =substr(X,42,23);
    output;
  end;
  format DATE date9. SIZE comma20.0;
  *drop X;
run;      &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;e way the line is parsed as Windows changes the file description line depending on its coonfiguration.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Sep 2017 22:47:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-extract-file-names-from-multiple-folders-in-a-drive/m-p/397640#M96118</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2017-09-20T22:47:41Z</dc:date>
    </item>
  </channel>
</rss>

