<?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 read the unix directory and unix date modified in SAS? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-read-the-unix-directory-and-unix-date-modified-in-SAS/m-p/783560#M249871</link>
    <description>&lt;P&gt;Another solution maybe:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=""&gt;filename filelist pipe "ls -lrtd /sas/data/master/*/ &amp;amp;&amp;amp; ls -lrtd /sas/data/master/*/*/";&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Unsure that'd work, my unix shell knowledge has not been used for a long time.&lt;/P&gt;</description>
    <pubDate>Thu, 02 Dec 2021 08:15:10 GMT</pubDate>
    <dc:creator>ChrisNZ</dc:creator>
    <dc:date>2021-12-02T08:15:10Z</dc:date>
    <item>
      <title>How to read the unix directory and unix date modified in SAS?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-read-the-unix-directory-and-unix-date-modified-in-SAS/m-p/783552#M249864</link>
      <description>&lt;P&gt;I have a script that needs to read the unix directory information such as path and the last modified date.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;filename filelist pipe "ls -lrtd /sas/data/master/*/";

data directory_raw;
infile filelist truncover;
input filename $1000.;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The script will first list out all files and folders from the directory&amp;nbsp;&lt;CODE class=""&gt;/sas/data/master/*/&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;What I actually &lt;STRONG&gt;want to achieve&lt;/STRONG&gt; here is to find what is inside&amp;nbsp;&lt;CODE class=""&gt;/sas/data/master/&lt;STRONG&gt;*/*&lt;/STRONG&gt;/&amp;nbsp;&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE class=""&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;I created this thread to seek help for allowing me to scan the files in the directory, scan for its last modified date and delete it if it exceeded 30 days. To do so, I need to first identify each and every files and folders' last modified date.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Since it is a ls command in unix, I have limited control. Notice that I want to actually drill down into the the second * in the unix directory. Is there anyone that can assist for me to identify the last modified date from unix directory (at least)?&lt;/P&gt;</description>
      <pubDate>Thu, 02 Dec 2021 07:26:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-read-the-unix-directory-and-unix-date-modified-in-SAS/m-p/783552#M249864</guid>
      <dc:creator>StickyRoll</dc:creator>
      <dc:date>2021-12-02T07:26:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to read the unix directory and unix date modified in SAS?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-read-the-unix-directory-and-unix-date-modified-in-SAS/m-p/783559#M249870</link>
      <description>&lt;P&gt;why not add option s to the ls command?&lt;/P&gt;</description>
      <pubDate>Thu, 02 Dec 2021 08:06:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-read-the-unix-directory-and-unix-date-modified-in-SAS/m-p/783559#M249870</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2021-12-02T08:06:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to read the unix directory and unix date modified in SAS?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-read-the-unix-directory-and-unix-date-modified-in-SAS/m-p/783560#M249871</link>
      <description>&lt;P&gt;Another solution maybe:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=""&gt;filename filelist pipe "ls -lrtd /sas/data/master/*/ &amp;amp;&amp;amp; ls -lrtd /sas/data/master/*/*/";&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Unsure that'd work, my unix shell knowledge has not been used for a long time.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Dec 2021 08:15:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-read-the-unix-directory-and-unix-date-modified-in-SAS/m-p/783560#M249871</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2021-12-02T08:15:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to read the unix directory and unix date modified in SAS?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-read-the-unix-directory-and-unix-date-modified-in-SAS/m-p/783564#M249873</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename filelist pipe "find /sas/data/master -type f -mtime +30 -print 2&amp;gt;&amp;amp;1";

data directory_raw;
infile filelist truncover;
input filename $1000.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Once you have verified that it works correctly, you can expand the external command to&lt;/P&gt;
&lt;PRE&gt;find /sas/data/master -type f -mtime +30 -print -exec rm -f {} \;&lt;/PRE&gt;
&lt;P&gt;so that it removes the files also.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Dec 2021 08:45:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-read-the-unix-directory-and-unix-date-modified-in-SAS/m-p/783564#M249873</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-12-02T08:45:18Z</dc:date>
    </item>
  </channel>
</rss>

