<?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 get the complete file listing on a unix server and put this info in a sas dataset in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-get-the-complete-file-listing-on-a-unix-server-and-put/m-p/912802#M44205</link>
    <description>&lt;P&gt;If you're allowed to execute OS commands out of SAS (option XCMD set) and it's a Unix/Linux environment then I'd certainly use the Unix find command for this via a filename pipe.&lt;/P&gt;
&lt;P&gt;The find command is by nature recursive. Code along the line of below should do the job (not tested! - but I've used similar logic in the past successfully).&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename listing pipe 'find / \( -name "*.sas7b" -o -name "*.csv" \) -type f -printf "%h|%f|%CF\n"';
data want;
  infile listing truncover dlm='|';
  input path:$300. name$50. modification_date:yymmdd10.;&lt;BR /&gt;  format modification_date date9.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Ideally first use a command prompt like Putty to fully test the find command syntax you need ...and only run it against a sub-folder and not the whole file system -&amp;gt; find /folder1/folder2/...&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The \n at the end of -printf adds a newline character at the end of each match to ease reading the result with a SAS data step.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also be aware that you will only find files in folders for which the user under which the process runs got a least the permission to list the files.&lt;/P&gt;</description>
    <pubDate>Wed, 24 Jan 2024 10:16:53 GMT</pubDate>
    <dc:creator>Patrick</dc:creator>
    <dc:date>2024-01-24T10:16:53Z</dc:date>
    <item>
      <title>How to get the complete file listing on a unix server and put this info in a sas dataset</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-get-the-complete-file-listing-on-a-unix-server-and-put/m-p/912760#M44201</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The task that I need to carry out is to put in a SAS dataset, the complete file listing of a Unix Server.&amp;nbsp; I need to refine my search with file extension (spde file, base dataset, text file, csv file, xlsx file) .&amp;nbsp; I need to know tha age of each file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am looking for a Unix command that I could use with a x command in SAS.&lt;/P&gt;
&lt;P&gt;Please provide base script.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jan 2024 22:07:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-get-the-complete-file-listing-on-a-unix-server-and-put/m-p/912760#M44201</guid>
      <dc:creator>alepage</dc:creator>
      <dc:date>2024-01-23T22:07:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the complete file listing on a unix server and put this info in a sas dataset</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-get-the-complete-file-listing-on-a-unix-server-and-put/m-p/912761#M44202</link>
      <description>&lt;P&gt;Check out this post:&lt;BR /&gt;&lt;A href="https://communities.sas.com/t5/SAS-Programming/Importing-File-name-and-Modified-date-into-dataset/m-p/903637" target="_blank"&gt;Solved: Importing File name and Modified date into dataset - SAS Support Communities&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jan 2024 22:15:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-get-the-complete-file-listing-on-a-unix-server-and-put/m-p/912761#M44202</guid>
      <dc:creator>SASJedi</dc:creator>
      <dc:date>2024-01-23T22:15:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the complete file listing on a unix server and put this info in a sas dataset</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-get-the-complete-file-listing-on-a-unix-server-and-put/m-p/912780#M44203</link>
      <description>&lt;P&gt;My &lt;A href="https://communities.sas.com/t5/SAS-User-Groups-Library/WUSS-Presentation-Talking-to-Your-Host/ta-p/838344" target="_blank" rel="noopener"&gt;WUSS 2022 presentation&lt;/A&gt; contains a program which recursively traverses a directory tree.&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jan 2024 07:14:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-get-the-complete-file-listing-on-a-unix-server-and-put/m-p/912780#M44203</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2024-01-24T07:14:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the complete file listing on a unix server and put this info in a sas dataset</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-get-the-complete-file-listing-on-a-unix-server-and-put/m-p/912782#M44204</link>
      <description>&lt;P&gt;Alternatively, use the UNIX &lt;FONT face="courier new,courier"&gt;find&lt;/FONT&gt; command with INFILE PIPE and parse the return for the modified date.&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jan 2024 07:16:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-get-the-complete-file-listing-on-a-unix-server-and-put/m-p/912782#M44204</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2024-01-24T07:16:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the complete file listing on a unix server and put this info in a sas dataset</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-get-the-complete-file-listing-on-a-unix-server-and-put/m-p/912802#M44205</link>
      <description>&lt;P&gt;If you're allowed to execute OS commands out of SAS (option XCMD set) and it's a Unix/Linux environment then I'd certainly use the Unix find command for this via a filename pipe.&lt;/P&gt;
&lt;P&gt;The find command is by nature recursive. Code along the line of below should do the job (not tested! - but I've used similar logic in the past successfully).&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename listing pipe 'find / \( -name "*.sas7b" -o -name "*.csv" \) -type f -printf "%h|%f|%CF\n"';
data want;
  infile listing truncover dlm='|';
  input path:$300. name$50. modification_date:yymmdd10.;&lt;BR /&gt;  format modification_date date9.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Ideally first use a command prompt like Putty to fully test the find command syntax you need ...and only run it against a sub-folder and not the whole file system -&amp;gt; find /folder1/folder2/...&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The \n at the end of -printf adds a newline character at the end of each match to ease reading the result with a SAS data step.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also be aware that you will only find files in folders for which the user under which the process runs got a least the permission to list the files.&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jan 2024 10:16:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-get-the-complete-file-listing-on-a-unix-server-and-put/m-p/912802#M44205</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2024-01-24T10:16:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the complete file listing on a unix server and put this info in a sas dataset</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-get-the-complete-file-listing-on-a-unix-server-and-put/m-p/912844#M44206</link>
      <description>&lt;P&gt;Hello Mr. Bremser,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We are starting a new project called Data Retention.&amp;nbsp; The goal of this project is to trace in our production server, all datasets or table such as base SAS dataset, SPDE file, Text file, CSV file, Excel files and so on.&amp;nbsp; The first step is to make a listing of all those file, their location and the creation Date.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Which of your unix command is the best for this purpose.&lt;/P&gt;
&lt;P&gt;Best Regards&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jan 2024 15:38:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-get-the-complete-file-listing-on-a-unix-server-and-put/m-p/912844#M44206</guid>
      <dc:creator>alepage</dc:creator>
      <dc:date>2024-01-24T15:38:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the complete file listing on a unix server and put this info in a sas dataset</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-get-the-complete-file-listing-on-a-unix-server-and-put/m-p/912857#M44207</link>
      <description>&lt;P&gt;UNIX does not keep the creation date, only the timestamp of the last modification.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/12447"&gt;@Patrick&lt;/a&gt;&amp;nbsp;has already shown an example for the usage of the find command. You should issue the command first from a commandline (log on to the server with ssh) to see if the command itself is correct. Then proceed to run it from within SAS.&lt;/P&gt;
&lt;P&gt;As also mentioned, you can only list directories for which you (the user under which the command is issued) have read permission.&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jan 2024 16:39:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-get-the-complete-file-listing-on-a-unix-server-and-put/m-p/912857#M44207</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2024-01-24T16:39:09Z</dc:date>
    </item>
  </channel>
</rss>

