<?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: Get directory listing on linux in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Get-directory-listing-on-linux/m-p/209524#M51920</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I would be a little more careful in determining the extension.&amp;nbsp; Unix files could have no extension or even not have a dot at all. Or could have the dot as the first character.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 14pt;"&gt;&amp;nbsp; if 1 &amp;lt; index(fname,'.') &amp;lt; length(fname) then ext=scan(fname,-1,'.');&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 14pt;"&gt;&amp;nbsp; else ext=' ';&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 18 Jun 2015 18:00:41 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2015-06-18T18:00:41Z</dc:date>
    <item>
      <title>Get directory listing on linux</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Get-directory-listing-on-linux/m-p/209520#M51916</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm trying to get the directory listing of shape files on Linux.&amp;nbsp; When I do it on windows this code works, but I can't find the equivalent for Linux.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_14346484171111565" jivemacro_uid="_14346484171111565"&gt;
&lt;P&gt;Filename filelist pipe "dir /b /s c:\temp\*.shp";&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;
&lt;P&gt;data shapefiles ;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;
&lt;P&gt;&amp;nbsp; infile filelist truncover ;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; input filename $100. ;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;
&lt;P&gt;run ;&lt;/P&gt;

&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I know linux uses ls for listing, but I'm not sure how to use it within the filename statement or do I have to use a different approach?&lt;/P&gt;&lt;P&gt;I'm using SAS 9.3 (TS1M2) on linux&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Jun 2015 17:26:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Get-directory-listing-on-linux/m-p/209520#M51916</guid>
      <dc:creator>jerry898969</dc:creator>
      <dc:date>2015-06-18T17:26:26Z</dc:date>
    </item>
    <item>
      <title>Re: Get directory listing on linux</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Get-directory-listing-on-linux/m-p/209521#M51917</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The appropriate LS command should replace "dir /b/s c:\temp\*.shp"; Obviously use a Unix/Linux path in lieu of C:\temp&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Jun 2015 17:41:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Get-directory-listing-on-linux/m-p/209521#M51917</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2015-06-18T17:41:37Z</dc:date>
    </item>
    <item>
      <title>Re: Get directory listing on linux</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Get-directory-listing-on-linux/m-p/209522#M51918</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi ballardw,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for your help.&amp;nbsp; I was able to figure it out taking this approach.&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_14346498013044570" jivemacro_uid="_14346498013044570" modifiedtitle="true"&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;rsubmit ;&lt;/P&gt;
&lt;P&gt;data temp (keep=fname) ;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; rc=filename("filelist", "~/shape/") ;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; did=dopen('filelist') ;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; nf=dnum(did) ;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; do i=1 to nf;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; fname=dread(did, i);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ext=scan(fname,-1) ;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if ext = 'shp' then output ;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; rc=dclose(did);&lt;/P&gt;
&lt;P&gt;run ;&lt;/P&gt;
&lt;P&gt;endrsubmit ;&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do you see any issues by taking this approach? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;Jerry&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Jun 2015 17:50:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Get-directory-listing-on-linux/m-p/209522#M51918</guid>
      <dc:creator>jerry898969</dc:creator>
      <dc:date>2015-06-18T17:50:28Z</dc:date>
    </item>
    <item>
      <title>Re: Get directory listing on linux</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Get-directory-listing-on-linux/m-p/209523#M51919</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There is absolutely nothing wrong with using the external file information functions. The PIPE options are really more useful when you have to run another program that directs output to standard output.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Jun 2015 17:53:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Get-directory-listing-on-linux/m-p/209523#M51919</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2015-06-18T17:53:54Z</dc:date>
    </item>
    <item>
      <title>Re: Get directory listing on linux</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Get-directory-listing-on-linux/m-p/209524#M51920</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I would be a little more careful in determining the extension.&amp;nbsp; Unix files could have no extension or even not have a dot at all. Or could have the dot as the first character.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 14pt;"&gt;&amp;nbsp; if 1 &amp;lt; index(fname,'.') &amp;lt; length(fname) then ext=scan(fname,-1,'.');&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 14pt;"&gt;&amp;nbsp; else ext=' ';&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Jun 2015 18:00:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Get-directory-listing-on-linux/m-p/209524#M51920</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2015-06-18T18:00:41Z</dc:date>
    </item>
    <item>
      <title>Re: Get directory listing on linux</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Get-directory-listing-on-linux/m-p/209525#M51921</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you both for your help.&amp;nbsp; I appreciate it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tom, thank you for pointing that out.&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Jun 2015 18:25:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Get-directory-listing-on-linux/m-p/209525#M51921</guid>
      <dc:creator>jerry898969</dc:creator>
      <dc:date>2015-06-18T18:25:05Z</dc:date>
    </item>
    <item>
      <title>Re: Get directory listing on linux</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Get-directory-listing-on-linux/m-p/209526#M51922</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The UNIX &lt;SPAN style="font-family: courier new,courier;"&gt;ls&lt;/SPAN&gt; option for recursive listing of subdirectories is &lt;SPAN style="font-family: courier new,courier;"&gt;-R&lt;/SPAN&gt;. You might also look at using the &lt;SPAN style="font-family: courier new,courier;"&gt;find&lt;/SPAN&gt; command for your purpose, as it is much more powerful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Keep in mind that using wildcards (? or *) in the command on UNIX may produce unexpected results, as the wildcards are expanded by the shell (unsing the contents of the current working directory) before handing off the commandline options to the command itself. Using the &lt;SPAN style="font-family: courier new,courier;"&gt;find&lt;/SPAN&gt; command and &lt;SPAN style="font-family: courier new,courier;"&gt;-name \*.shp&lt;/SPAN&gt; may be better. (the backslash prevents the shell from expanding the wildcards)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Jun 2015 06:09:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Get-directory-listing-on-linux/m-p/209526#M51922</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2015-06-19T06:09:53Z</dc:date>
    </item>
  </channel>
</rss>

