<?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 do I make much faster my Windows fileserver file inventory? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-make-much-faster-my-Windows-fileserver-file-inventory/m-p/582844#M165850</link>
    <description>&lt;P&gt;The SAS program is running a DIR command command already.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 21 Aug 2019 15:00:57 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2019-08-21T15:00:57Z</dc:date>
    <item>
      <title>How do I make much faster my Windows fileserver file inventory?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-make-much-faster-my-Windows-fileserver-file-inventory/m-p/582595#M165724</link>
      <description>&lt;P&gt;Windows experts please help! Thanks in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The following SAS code runs for more than a few days and fails to complete. It issues a recursive Windows DIR command with which I want to gather the following metadata on all the files on a large Windows fileserver.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;folder_path&lt;/LI&gt;&lt;LI&gt;file_name&lt;/LI&gt;&lt;LI&gt;file_extension&lt;/LI&gt;&lt;LI&gt;file_owner&lt;/LI&gt;&lt;LI&gt;file_size_bytes&lt;/LI&gt;&lt;LI&gt;file_last_access_datetime&lt;/LI&gt;&lt;LI&gt;file_last_written_datetime&lt;/LI&gt;&lt;LI&gt;file_last_read_datetime&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;I estimate there are &amp;gt;5 million files on this fileserver based on the following results.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;H:\&amp;gt;dir "\\fsprod109\MTKA Public\*&lt;SPAN style="font-style: inherit !important; font-weight: inherit !important;"&gt;" /a:-D /T:A /-C /Q /s | find /c /v ""&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;6548474&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is some sample data produced by the DIR command.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;Volume in drive \\fsprod109\MTKA Public is New32k&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;Volume Serial Number is 3477-FAD7&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;Directory of \\fsprod109\MTKA Public&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;01/31/2019 08:26 AM 38622 CORP\First.Last (580).webpage&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;lt;snip&amp;gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;05/09/2019 04:16 PM 162 CORP\First.Last ~$EDIT MEMO FROM HABAND.docx&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;259 File(s) 6682831885 bytes&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;Directory of \\fsprod109\MTKA Public\.Trashes\1325560687\Recovered files\(A Document Being Saved By Word)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;02/12/2019 04:44 PM 27372 CORP\First.Last ~WRD0000&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;1 File(s) 27372 bytes&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;Directory of \\fsprod109\MTKA Public\.Trashes\156827625\Recovered files\(A Document Being Saved By Word 44)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;02/21/2019 04:03 PM 13035 CORP\First.Last ~WRL0760&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;1 File(s) 13035 bytes&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;Directory of \\fsprod109\MTKA Public\2-OfficeInstallers&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;06/26/2019 10:20 AM 754 CORP\First.Last Pictures - Shortcut.lnk&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;10/30/2017 12:48 PM 299 CORP\First.Last ServerInstallO365PPx64.xml&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;06/05/2017 09:40 AM 299 CORP\First.Last ServerInstallO365PPx86.xml&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;06/05/2017 09:40 AM 295 CORP\First.Last ServerInstallO365VPx64.xml&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;06/05/2017 09:40 AM 295 CORP\First.Last ServerInstallO365VPx86.xml&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;06/05/2017 09:40 AM 299 CORP\First.Last ServerInstallO365x64.xml&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;06/05/2017 09:40 AM 299 CORP\First.Last ServerInstallO365x86.xml&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;06/05/2017 09:40 AM 1078456 CORP\First.Last setup.exe&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;06/05/2017 09:40 AM 86 CORP\First.Last uninstall link.txt&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;9 File(s) 1081082 bytes&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the current code that I would like to run faster and complete.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;FILENAME pipedir pipe "dir ""\\fsprod109\MTKA Public\*"" /a:-D /T:A /-C /Q /s" lrecl=5000;

DATA WORK.fileextensions;
  DROP line regex regex_id;

  INFILE pipedir TRUNCOVER;

  IF _N_ = 1 THEN DO;
    RETAIN regex_id;
    
    regex = '/&amp;lt;DIR&amp;gt;|FILE\(S\)|DIR\(S\)/';
    
    regex_id = PRXPARSE(regex);
    IF MISSING(regex_id) THEN DO;
      PUTLOG "ERROR: Invalid regular expression " regex;
      STOP;
    END;
  END;

  INPUT line $char1000.;

  *PUT "INPUT LINE " _N_= line=;

  LENGTH directory $1000;
  RETAIN directory;

  IF line = ' '
  OR PRXMATCH(regex_id, UPCASE(line)) &amp;gt; 0
  OR UPCASE(LEFT(line)) IN:('VOLUME','TOTAL FILES LISTED:')
  THEN DO;
    *PUT "DIR/VOL/FILE/BYTE " _N_= line=;
    DELETE;
  END;

  ELSE if UPCASE(LEFT(line))=:'DIRECTORY OF' THEN DO;
    directory = LEFT(SUBSTR(line,INDEX(UPCASE(line),'DIRECTORY OF')+12));
    *PUT "DIRECTORY OF " _N_= line= directory=;
    DELETE;
  END;

  ELSE DO;
   *INPUT @01 file_last_access_datetime ANYDTDTM21.
          @22 file_size_bytes                   17.
          @40 file_owner                       $23.
          @63 file_name                       $256.
    ;

    file_last_access_datetime = INPUT(SUBSTR(line, 1, 21),ANYDTDTM21.);
    file_size_bytes           = INPUT(SUBSTR(line,22, 17),        17.);
    file_owner                =       SUBSTR(line,40, 23)             ;
    file_name                 =       SUBSTR(line,63,256)             ;

    file_extension = LOWCASE(SCAN(file_name, -1, "."));

    *PUT "INPUT/OUTPUT " _ALL_;

    OUTPUT;
  END;

  FORMAT file_last_access_datetime E8601DT19.;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Aug 2019 21:20:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-make-much-faster-my-Windows-fileserver-file-inventory/m-p/582595#M165724</guid>
      <dc:creator>dmbuffum3</dc:creator>
      <dc:date>2019-08-20T21:20:47Z</dc:date>
    </item>
    <item>
      <title>Re: How do I make much faster my Windows fileserver file inventory?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-make-much-faster-my-Windows-fileserver-file-inventory/m-p/582600#M165729</link>
      <description>Don't know how to answer your question but you've included a bunch of people's name in the post. Is that something you're allowed to publicly post?&lt;BR /&gt;&lt;BR /&gt;How long does it take to get a full list just via the OS, not including SAS? Do you have to include all the switches listed for your file path and have you tried reducing that to save space?</description>
      <pubDate>Tue, 20 Aug 2019 21:11:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-make-much-faster-my-Windows-fileserver-file-inventory/m-p/582600#M165729</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-08-20T21:11:28Z</dc:date>
    </item>
    <item>
      <title>Re: How do I make much faster my Windows fileserver file inventory?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-make-much-faster-my-Windows-fileserver-file-inventory/m-p/582605#M165734</link>
      <description>&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt; Thanks for pointing out my mistake in posting some names. Now corrected.</description>
      <pubDate>Tue, 20 Aug 2019 21:21:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-make-much-faster-my-Windows-fileserver-file-inventory/m-p/582605#M165734</guid>
      <dc:creator>dmbuffum3</dc:creator>
      <dc:date>2019-08-20T21:21:48Z</dc:date>
    </item>
    <item>
      <title>Re: How do I make much faster my Windows fileserver file inventory?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-make-much-faster-my-Windows-fileserver-file-inventory/m-p/582680#M165785</link>
      <description>&lt;P&gt;Where are you running your SAS program? On a PC or a remote SAS server? If it is your PC, check Windows Task Manager to see if there are any bottlenecks with CPU, memory, IO or network traffic usage. My suspicion is your network is what might be slowing you down but that is just a guess.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also try running a test on a small directory of your file server so you can estimate more accurately how long it would take to expand the processing.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Aug 2019 06:39:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-make-much-faster-my-Windows-fileserver-file-inventory/m-p/582680#M165785</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2019-08-21T06:39:23Z</dc:date>
    </item>
    <item>
      <title>Re: How do I make much faster my Windows fileserver file inventory?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-make-much-faster-my-Windows-fileserver-file-inventory/m-p/582781#M165833</link>
      <description>&lt;P&gt;The SAS workspace server is running on Windows Server 2016.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Perhaps it would make sense to execute a Windows DIR command, PowerShell script, or VB Script that creates an output CSV file on the server, which I could read from SAS in a subsequent step.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Which Windows tool would be easier to prepare and tend to execute more efficiently?&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Windows DIR&lt;/LI&gt;&lt;LI&gt;PowerShell&lt;/LI&gt;&lt;LI&gt;VB Script&lt;/LI&gt;&lt;LI&gt;Other?&lt;/LI&gt;&lt;/OL&gt;</description>
      <pubDate>Wed, 21 Aug 2019 13:50:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-make-much-faster-my-Windows-fileserver-file-inventory/m-p/582781#M165833</guid>
      <dc:creator>dmbuffum3</dc:creator>
      <dc:date>2019-08-21T13:50:50Z</dc:date>
    </item>
    <item>
      <title>Re: How do I make much faster my Windows fileserver file inventory?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-make-much-faster-my-Windows-fileserver-file-inventory/m-p/582844#M165850</link>
      <description>&lt;P&gt;The SAS program is running a DIR command command already.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Aug 2019 15:00:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-make-much-faster-my-Windows-fileserver-file-inventory/m-p/582844#M165850</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-08-21T15:00:57Z</dc:date>
    </item>
    <item>
      <title>Re: How do I make much faster my Windows fileserver file inventory?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-make-much-faster-my-Windows-fileserver-file-inventory/m-p/582860#M165856</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/220531"&gt;@dmbuffum3&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Windows experts please help! Thanks in advance.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The following SAS code runs for more than a few days and fails to complete. It issues a recursive Windows DIR command with which I want to gather the following metadata on all the files on a large Windows fileserver.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;folder_path&lt;/LI&gt;
&lt;LI&gt;file_name&lt;/LI&gt;
&lt;LI&gt;file_extension&lt;/LI&gt;
&lt;LI&gt;file_owner&lt;/LI&gt;
&lt;LI&gt;file_size_bytes&lt;/LI&gt;
&lt;LI&gt;file_last_access_datetime&lt;/LI&gt;
&lt;LI&gt;file_last_written_datetime&lt;/LI&gt;
&lt;LI&gt;file_last_read_datetime&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;I estimate there are &lt;STRONG&gt;&amp;gt;5 million&lt;/STRONG&gt; files on this fileserver based on the following results.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I might suggest breaking this into a few smaller jobs so that you have&amp;nbsp;different root directories and save each to a different data set.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;dir "\\fsprod109\MTKA Public\somefolder\*&lt;SPAN style="font-style: inherit !important; font-weight: inherit !important;"&gt;" &lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That way you may get some useable data without having to wait "days".&lt;/P&gt;
&lt;P&gt;Performance related to network drives may be fun to address. Bandwidth, permissions, priorities and the every popular network security rules may have an impact.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Aug 2019 15:24:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-make-much-faster-my-Windows-fileserver-file-inventory/m-p/582860#M165856</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-08-21T15:24:10Z</dc:date>
    </item>
  </channel>
</rss>

