<?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: Size of a directory in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Size-of-a-directory/m-p/641638#M191274</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/12151"&gt;@Jagadishkatam&lt;/a&gt;&amp;nbsp;When XCMD is disabled, the X statement will not be available.&lt;/P&gt;</description>
    <pubDate>Tue, 21 Apr 2020 15:01:04 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2020-04-21T15:01:04Z</dc:date>
    <item>
      <title>Size of a directory</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Size-of-a-directory/m-p/641626#M191264</link>
      <description>&lt;P&gt;All,&lt;/P&gt;&lt;P&gt;How to find the full size of a folder through SAS code(in UNIX ).&lt;/P&gt;&lt;P&gt;Can't use pipe as we are constrained by SAS NOXCMD option.&lt;/P&gt;&lt;P&gt;below code has pipe so no luck with this.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename du pipe "du -q /data/team";
data work.diskusage;
infile du;
input @;
put _infile_;
if ( _infile_ =: 'Size:' ) then do;
    sizeInBytes = input(scan(_infile_,2,' '), comma32.);
    output;
end;
input;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;SS&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Apr 2020 14:12:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Size-of-a-directory/m-p/641626#M191264</guid>
      <dc:creator>sathya66</dc:creator>
      <dc:date>2020-04-21T14:12:31Z</dc:date>
    </item>
    <item>
      <title>Re: Size of a directory</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Size-of-a-directory/m-p/641636#M191272</link>
      <description>&lt;P&gt;you can try something as below without use of any pipe symbol&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1) use the x command with unix commands like du -h with the path of the directory for which we need to identify the size and also direct the size of directory to a file txt file with symbol &amp;gt;.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2) import the txt file with the filesize&lt;/P&gt;
&lt;P&gt;3) use scan function to get the size into a separate variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;x "du -h ¬path &amp;gt; ¬path/text.txt";

proc import datafile='¬path/text.txt' out=have dbms=dlm replace;
getnames=no;
run;

data want;
set have;
size=scan(var1,1,'/');
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 21 Apr 2020 15:18:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Size-of-a-directory/m-p/641636#M191272</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2020-04-21T15:18:27Z</dc:date>
    </item>
    <item>
      <title>Re: Size of a directory</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Size-of-a-directory/m-p/641638#M191274</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/12151"&gt;@Jagadishkatam&lt;/a&gt;&amp;nbsp;When XCMD is disabled, the X statement will not be available.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Apr 2020 15:01:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Size-of-a-directory/m-p/641638#M191274</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-04-21T15:01:04Z</dc:date>
    </item>
    <item>
      <title>Re: Size of a directory</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Size-of-a-directory/m-p/641639#M191275</link>
      <description>&lt;P&gt;Try this macro:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro size(directory);
%local did i name subdir fref fref2 size;
%let size = 0;
%let did = %sysfunc(filename(fref,&amp;amp;directory));
%let did = %sysfunc(dopen(&amp;amp;fref));
%if &amp;amp;did ne 0
%then %do;
  %do i = 1 %to %sysfunc(dnum(&amp;amp;did));
    %let name = &amp;amp;directory/%sysfunc(dread(&amp;amp;did,&amp;amp;i));
    %let subdir = %sysfunc(filename(fref2,&amp;amp;name));
    %let subdir = %sysfunc(dopen(&amp;amp;fref2));
    %if &amp;amp;subdir ne 0
    %then %do;
      %let subdir=%sysfunc(dclose(&amp;amp;subdir));
      %let size = %eval(&amp;amp;size + %size(&amp;amp;name));
    %end;
    %else %do;
      %let fid = %sysfunc(fopen(&amp;amp;fref2));
      %let size = %eval(&amp;amp;size + %sysfunc(finfo(&amp;amp;fid,Dateigröße (Byte))));
      %let fid = %sysfunc(fclose(&amp;amp;fid));
    %end;
    %let subdir=%sysfunc(filename(fref2));
  %end;
  %let did=%sysfunc(dclose(&amp;amp;did));
%end;
%let did=%sysfunc(filename(fref));
&amp;amp;size
%mend;
%put size=%size(/folders/myfolders);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This code is tested on SAS UE on a Mac with a German locale. That's why the name of the file information item is "Dateigröße (Byte)".&lt;/P&gt;
&lt;P&gt;You need to determine the name of the information item in your locale by running&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data items;
length fref $8;
rc = filename(fref,'/name_of_an_existing_file');
fid = fopen(fref);
do i = 1 to foptnum(fid);
  item = foptname(fid,i);
  output;
end;
fid = fclose(fid);
rc = filename(fref);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Apr 2020 15:04:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Size-of-a-directory/m-p/641639#M191275</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-04-21T15:04:25Z</dc:date>
    </item>
    <item>
      <title>Re: Size of a directory</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Size-of-a-directory/m-p/641640#M191276</link>
      <description>&lt;P&gt;Something similar to this should work: You provide the "physical-name" of your folder. It should start at a mount point. This should get all of the directory properties.&lt;/P&gt;
&lt;PRE&gt;data diropts;
   length optname $ 12 optval $ 40;
   keep optname optval;
   rc=filename("mydir", "physical-name");
   did=dopen("mydir");
   numopts=doptnum(did);
   do i=1 to numopts;
      optname=doptname(did, i);
      optval=dinfo(did, optname);
      output;
   end;
   run;&lt;/PRE&gt;
&lt;P&gt;DOPEN function opens a directory, Doptname is the name of an option or charactersitic, Dinfo is the value of the option. There really should be a DCLOSE after getting the options read.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Apr 2020 15:07:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Size-of-a-directory/m-p/641640#M191276</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-04-21T15:07:36Z</dc:date>
    </item>
    <item>
      <title>Re: Size of a directory</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Size-of-a-directory/m-p/641641#M191277</link>
      <description>&lt;P&gt;You need to use DOPEN() , DREAD(), FILEINFO() etc to read the filesize for each file.&amp;nbsp; Look in the SAS on line manual for those statements and there should be examples.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you need to recurse into sub directories then it might be a little complicated.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Apr 2020 15:10:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Size-of-a-directory/m-p/641641#M191277</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-04-21T15:10:16Z</dc:date>
    </item>
    <item>
      <title>Re: Size of a directory</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Size-of-a-directory/m-p/641642#M191278</link>
      <description>&lt;P&gt;On a UNIX system, this does not return any size at all, not even the size of the directory file itself:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data diropts;
   length optname $ 30 optval $ 40;
   keep optname optval;
   rc=filename("mydir", "/folders/myfolders");
   did=dopen("mydir");
   numopts=doptnum(did);
   do i=1 to numopts;
      optname=doptname(did, i);
      optval=dinfo(did, optname);
      output;
   end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Resulting dataset:&lt;/P&gt;
&lt;PRE&gt;	
optname
optval
1	Verzeichnis	/folders/myfolders	
2	Besitzername	root	
3	Gruppenname	vboxsf	
4	Zugriffsberechtigung	drwxrwx---	
5	Zuletzt geändert	21. April 2020 17.09 Uhr&lt;/PRE&gt;</description>
      <pubDate>Tue, 21 Apr 2020 15:10:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Size-of-a-directory/m-p/641642#M191278</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-04-21T15:10:48Z</dc:date>
    </item>
    <item>
      <title>Re: Size of a directory</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Size-of-a-directory/m-p/641643#M191279</link>
      <description>The SIZE of a directory is pretty meaningless. It just is reflection of how many bytes it takes to store the list of filenames and links.&lt;BR /&gt;You need to check each individual file in the directory using FINFO() function.&lt;BR /&gt;</description>
      <pubDate>Tue, 21 Apr 2020 15:14:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Size-of-a-directory/m-p/641643#M191279</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-04-21T15:14:36Z</dc:date>
    </item>
    <item>
      <title>Re: Size of a directory</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Size-of-a-directory/m-p/641644#M191280</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;wrote:
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you need to recurse into sub directories then it might be a little complicated.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;See my answer. Since macros can be used recursively, they are the tool of choice here IMO.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But compared to using a simple du -sk, the code is ridiculous. I cannot (and will never) fathom the reasons for NOXCMD.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Apr 2020 15:14:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Size-of-a-directory/m-p/641644#M191280</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-04-21T15:14:42Z</dc:date>
    </item>
    <item>
      <title>Re: Size of a directory</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Size-of-a-directory/m-p/641645#M191281</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;The SIZE of a directory is pretty meaningless. It just is reflection of how many bytes it takes to store the list of filenames and links.&lt;BR /&gt;You need to check each individual file in the directory using FINFO() function.&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;That's exactly what my macro does. Run it for a test.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Apr 2020 15:15:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Size-of-a-directory/m-p/641645#M191281</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-04-21T15:15:47Z</dc:date>
    </item>
    <item>
      <title>Re: Size of a directory</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Size-of-a-directory/m-p/641659#M191287</link>
      <description>&lt;P&gt;The macro will work well when you just want to get the one number out.&lt;/P&gt;
&lt;P&gt;To get the full list of files you should stick with data step code.&amp;nbsp; Here is method using the MODIFY statement to process all of the entries in a directory tree(s) based on this post:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Programming/listing-all-files-within-a-levelectory-and-sublevelectories/m-p/332616/highlight/true#M74887" target="_blank" rel="noopener"&gt;https://communities.sas.com/t5/SAS-Programming/listing-all-files-within-a-levelectory-and-sublevelectories/m-p/332616/highlight/true#M74887&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;First you make a dataset with the structure you want and any variables you are going to keep.&amp;nbsp; Then in a second step use MODIFY to check each observation if it is a directory or not. For directories you append the directory entries and for non-directories you gather the information you want.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;On Unix info numbers 5 and 6 are last mod date and size.&amp;nbsp; The info numbers could be different on other OS.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data filelist;
  length dname filename $256 dir level 8 lastmod size 8;
  format lastmod datetime20.;
  input dname;
  retain filename ' ' level 0 dir 1;
cards4;
~/temp
;;;;

data filelist;
  modify filelist;
  rc1=filename('tmp',catx('/',dname,filename));
  rc2=dopen('tmp');
  dir = not not rc2;
  if not dir then do;
    fid=fopen('tmp','i',0,'b');
    lastmod=input(finfo(fid,foptname(fid,5)),datetime24.);
    size=input(finfo(fid,foptname(fid,6)),32.);
    fid=fclose(fid);
  end;
  else do;
    dname=catx('/',dname,filename);
    filename=' ';
  end;
  replace;
  if dir;
  level=level+1;
  do i=1 to dnum(rc2);
    filename=dread(rc2,i);
    output;
  end;
  rc3=dclose(rc2);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Now you can use SAS to summarize the data.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc summary data=filelist ;
  class dname ;
  var lastmod size;
  output out=summary
   sum(size)=total_size
   max(lastmod)=max_ts
 ;
run;
proc print width=min;
 format total_size comma20.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;Obs    dname                      _TYPE_    _FREQ_    total_size          max_ts

 1                                   0        85      12,055,127    10JUL2019:11:34:31
 2     ~/temp                        1        43       9,885,263    10JUL2019:11:34:31
 3     ~/temp/autocutsel-0.9.0       1        38       1,728,684    11NOV2013:16:05:57
 4     ~/temp/drg                    1         4         441,180    22FEB2014:10:37:17&lt;/PRE&gt;</description>
      <pubDate>Tue, 21 Apr 2020 16:21:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Size-of-a-directory/m-p/641659#M191287</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-04-21T16:21:07Z</dc:date>
    </item>
    <item>
      <title>Re: Size of a directory</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Size-of-a-directory/m-p/641684#M191302</link>
      <description>Thanks &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt; this is really useful to get a list of directory contents with the corresponding lastmod date which is not shown in SAS EG 7.x. I just stuck a proc print after the second data step. Just to let you know the first data step throws a warning so I included lastmod size 0 in the retain line;</description>
      <pubDate>Tue, 21 Apr 2020 17:18:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Size-of-a-directory/m-p/641684#M191302</guid>
      <dc:creator>ghosh</dc:creator>
      <dc:date>2020-04-21T17:18:20Z</dc:date>
    </item>
    <item>
      <title>Re: Size of a directory</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Size-of-a-directory/m-p/641689#M191304</link>
      <description>I would missing instead of zero.  Zero is a valid datetime (1960). And zero is also a valid filesize.&lt;BR /&gt;You can use CALL MISSING() if you are worried about uninitialized variable informational notes.&lt;BR /&gt;</description>
      <pubDate>Tue, 21 Apr 2020 17:27:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Size-of-a-directory/m-p/641689#M191304</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-04-21T17:27:36Z</dc:date>
    </item>
    <item>
      <title>Re: Size of a directory</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Size-of-a-directory/m-p/641828#M191372</link>
      <description>&lt;P&gt;Great stuff,&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;!&lt;/P&gt;
&lt;P&gt;May I use your code as an example in my paper (it was planned for #SASGF2020, but I intend to present a revised and expanded version at #SASGF2021), as an alternative to the macro?&lt;/P&gt;</description>
      <pubDate>Wed, 22 Apr 2020 07:05:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Size-of-a-directory/m-p/641828#M191372</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-04-22T07:05:08Z</dc:date>
    </item>
    <item>
      <title>Re: Size of a directory</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Size-of-a-directory/m-p/641830#M191373</link>
      <description>&lt;P&gt;And I have found a useful modification to make it work in different locales:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;    lastmod=input(finfo(fid,foptname(fid,5)),NLDATMW.);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This worked at least with my German UE.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Apr 2020 07:34:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Size-of-a-directory/m-p/641830#M191373</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-04-22T07:34:26Z</dc:date>
    </item>
    <item>
      <title>Re: Size of a directory</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Size-of-a-directory/m-p/641852#M191391</link>
      <description>&lt;P&gt;Thanks All.&lt;/P&gt;&lt;P&gt;I can accept this as a solution. how can I convert them into GB rather than in bytes.&lt;/P&gt;&lt;P&gt;i think ,by doing&amp;nbsp; divided by 1024.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Apr 2020 08:49:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Size-of-a-directory/m-p/641852#M191391</guid>
      <dc:creator>sathya66</dc:creator>
      <dc:date>2020-04-22T08:49:54Z</dc:date>
    </item>
    <item>
      <title>Re: Size of a directory</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Size-of-a-directory/m-p/641858#M191395</link>
      <description>&lt;P&gt;Divide by 1024, and you get the size in K. Divide again, and you get size in M. Divide again, and you get size in G.&lt;/P&gt;
&lt;P&gt;So the size in G is&lt;/P&gt;
&lt;PRE&gt;size_in_bytes / (1024 * 1024 * 1024)&lt;/PRE&gt;</description>
      <pubDate>Wed, 22 Apr 2020 09:10:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Size-of-a-directory/m-p/641858#M191395</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-04-22T09:10:02Z</dc:date>
    </item>
    <item>
      <title>Re: Size of a directory</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Size-of-a-directory/m-p/642128#M191532</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;, great way to enable a pseudo-recursion within a data step. Kudos.&lt;/P&gt;
&lt;P&gt;Here is a working version for Windows&lt;/P&gt;
&lt;P&gt;I added a provision for locked files (FID=0)&amp;nbsp; and for the date format being different from Unix.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data FILELIST;
  retain SEP "%sysfunc(ifc(&amp;amp;sysscp=WIN,\,/))";
  modify FILELIST;
  RC1 = filename('tmp',catx(SEP, DNAME, FILENAME));
  RC2 = dopen('tmp');
  DIR = (RC2&amp;gt;0);
  if not DIR then do;
    FID=fopen('tmp','i',0,'b');  
    if FID then do; 
      LASTMOD=input(finfo(FID, foptname(FID, 5)), anydtdtm32.);
      SIZE   =input(finfo(FID, foptname(FID, 4)), 32.);
      FID    =fclose(FID);
    end;
  end;
  else do;
    DNAME=catx(SEP, DNAME, FILENAME);
    FILENAME=' ';
  end;
  replace;
  if DIR;
  LEVEL=LEVEL+1;
  do I=1 to dnum(RC2);
    FILENAME=dread(RC2, I);
    output;
  end;
  RC3=dclose(RC2);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Apr 2020 23:50:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Size-of-a-directory/m-p/642128#M191532</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2020-04-22T23:50:23Z</dc:date>
    </item>
    <item>
      <title>Re: Size of a directory</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Size-of-a-directory/m-p/642139#M191536</link>
      <description>&lt;P&gt;Actually you don't need the W version.&amp;nbsp; But the length matters.&amp;nbsp; NLDATM100 works best.&amp;nbsp; Out of the 135 values for LOCALE I found it could read the strings generated for 87 of them. Much better than DATETIME or ANYDTDTM.&lt;/P&gt;
&lt;PRE&gt;The MEANS Procedure

                      N
Variable      N    Miss
-----------------------
datetime      3     132
NLDATM       87      48
anydtdtm     33     102
-----------------------&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Apr 2020 00:58:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Size-of-a-directory/m-p/642139#M191536</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-04-23T00:58:32Z</dc:date>
    </item>
    <item>
      <title>Re: Size of a directory</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Size-of-a-directory/m-p/642180#M191549</link>
      <description>&lt;P&gt;I have found another improvement to your code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data filelist;
  modify filelist;
  rc1=filename('tmp',catx('/',dname,filename));
  rc2=dopen('tmp');
  dir = not not rc2;
  if not dir then do;
    fid=fopen('tmp','i',0,'b');
    lastmod=input(finfo(fid,foptname(fid,5)),NLDATM100.);
    size=input(finfo(fid,foptname(fid,6)),32.);
    fid=fclose(fid);
  end;
  else do;
    dname=catx('/',dname,filename);
    filename=' ';
    lastmod=input(dinfo(rc2,doptname(rc2,5)),NLDATM100.);
  end;
  replace;
  if dir;
  level=level+1;
  do i=1 to dnum(rc2);
    filename=dread(rc2,i);
    output;
  end;
  rc3=dclose(rc2);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;It will now record the modification timestamp for directories. The only thing that is missing is the size of the directory file itself, which cannot be determined with SAS functions; for this one would need the external command.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Apr 2020 08:00:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Size-of-a-directory/m-p/642180#M191549</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-04-23T08:00:42Z</dc:date>
    </item>
  </channel>
</rss>

