<?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: Help comparing file size of files in a directory. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Help-comparing-file-size-of-files-in-a-directory/m-p/130404#M26597</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So for all files on your c: drive, you could execute a batch program which gets a directory listing:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;dir /s c:\ *.* &amp;gt; listing.txt&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and then read listing.txt to parse out directory names, file names, and file sizes.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 07 Mar 2013 19:09:22 GMT</pubDate>
    <dc:creator>DBailey</dc:creator>
    <dc:date>2013-03-07T19:09:22Z</dc:date>
    <item>
      <title>Help comparing file size of files in a directory.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-comparing-file-size-of-files-in-a-directory/m-p/130398#M26591</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello world,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm fairly new to SAS and need some help. I'm trying to write a macro in EG that can open up a directory and create a data set that gives the size and file name of all files in that directory. I've seen some great examples in SAS papers but they require the pipe function and I don't have permission to use PIPE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So far I've had success in doing two things.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) Get all the filename's written to the log. This is done with a macro I found on SAS support. &lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;EM&gt;%macro drive(dir,ext);&lt;/EM&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;EM&gt;&amp;nbsp; %let filrf=mydir;&lt;/EM&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;EM&gt;&amp;nbsp; /* Assigns the fileref of mydir to the directory and opens the directory */&lt;/EM&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;EM&gt;&amp;nbsp; %let rc=%sysfunc(filename(filrf,&amp;amp;dir));&lt;/EM&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;EM&gt;&amp;nbsp; %let did=%sysfunc(dopen(&amp;amp;filrf));&lt;/EM&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;EM&gt;&amp;nbsp; /* Returns the number of members in the directory */&lt;/EM&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;EM&gt;&amp;nbsp; %let memcnt=%sysfunc(dnum(&amp;amp;did));&lt;/EM&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;EM&gt;&amp;nbsp; /* Loops through entire directory */&lt;/EM&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;EM&gt;&amp;nbsp; %do i = 1 %to &amp;amp;memcnt;&lt;/EM&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;EM&gt;&amp;nbsp; /* Returns the extension from each file */&lt;/EM&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;EM&gt;&amp;nbsp; %let name=%qscan(%qsysfunc(dread(&amp;amp;did,&amp;amp;i)),-1,.);&lt;/EM&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;EM&gt;&amp;nbsp; /* Checks to see if file contains an extension */&lt;/EM&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;EM&gt;&amp;nbsp; %if %qupcase(%qsysfunc(dread(&amp;amp;did,&amp;amp;i))) ne %qupcase(&amp;amp;name) %then&lt;/EM&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;EM&gt;&amp;nbsp; %do;&lt;/EM&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;EM&gt;&amp;nbsp; /* Checks to see if the extension matches the parameter value */&lt;/EM&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;EM&gt;&amp;nbsp; /* If condition is true prints the full name to the log */&lt;/EM&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;EM&gt;&amp;nbsp; %if (%superq(ext) ne and %qupcase(&amp;amp;name) = %qupcase(&amp;amp;ext)) or&lt;/EM&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;EM&gt;&amp;nbsp; (%superq(ext) = and %superq(name) ne) %then&lt;/EM&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;EM&gt;&amp;nbsp; %do;&lt;/EM&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;EM&gt;&amp;nbsp; %put %qsysfunc(dread(&amp;amp;did,&amp;amp;i));&lt;/EM&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;EM&gt;&amp;nbsp; %end;&lt;/EM&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;EM&gt;&amp;nbsp; %end;&lt;/EM&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;EM&gt;&amp;nbsp; %end;&lt;/EM&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;EM&gt;&amp;nbsp; /* Closes the directory */&lt;/EM&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;EM&gt;&amp;nbsp; %let rc=%sysfunc(dclose(&amp;amp;did));&lt;/EM&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;EM&gt;%mend drive;&lt;/EM&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;EM&gt;&lt;BR /&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;2) Get the size of one file at a time. I used the previous macro's output to manually make macro variables. Then feed them into this code.&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;EM&gt;%let Invoice=\\mydir;&lt;/EM&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;EM&gt;%let file1=&amp;lt;the file name returned by the last macro&amp;gt;&lt;/EM&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;EM&gt;&lt;BR /&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;EM&gt;data info;&lt;/EM&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp; length infoname infoval $60;&lt;/EM&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp; drop rc fid infonum i close;&lt;/EM&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp; rc=filename("abc","&amp;amp;invoice.&amp;amp;file1.");&lt;/EM&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp; fid=dopen("abc");&lt;/EM&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp; infonum=fnum(fid);&lt;/EM&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp; do i=1 to infonum;&lt;/EM&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; infoname=foptname(fid,i);&lt;/EM&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; infoval=finfo(fid,infoname);&lt;/EM&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;/EM&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp; end;&lt;/EM&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp; close=fclose(fid);&lt;/EM&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;EM&gt;run;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;A major problem with this is it only handles one file at a time, and I need all of this information to go into one location so I can look for files with the same size. I know I could make this into a loop that will output a bunch of datasets but this doesn't seem very efficient.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I envision this is see the first macro storing all file names as individual macro variables. I know this can be done with a loop to update a %let statement &amp;lt;%let file&amp;amp;I. = maybe dread(&amp;amp;did,&amp;amp;I.)&amp;gt;. But the right side of this equality is a major road block for me. &lt;/P&gt;&lt;P&gt;After getting the file names stored, I need to grab the file size. I'm having a hard time doing this because i know i need to use finfo() and I have a dopen() situation. Is there a way to trickle down so to speak? Stating at dopen() and eventually using fopen() so that I can use finfo().&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Major Questions:&lt;/P&gt;&lt;P&gt;How can I store system output functions as macro variable?&lt;/P&gt;&lt;P&gt;How can I go from a dopen() situation to a finfo() situation?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As a new programmer I'd really like guidance more than anything. I truly want to learn this not just have the code written for me. Any help would be much appreciated.&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Mar 2013 17:44:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-comparing-file-size-of-files-in-a-directory/m-p/130398#M26591</guid>
      <dc:creator>Jsendzik</dc:creator>
      <dc:date>2013-03-07T17:44:50Z</dc:date>
    </item>
    <item>
      <title>Re: Help comparing file size of files in a directory.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-comparing-file-size-of-files-in-a-directory/m-p/130399#M26592</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;what operating system do you use?&amp;nbsp; You may be able to do this more efficiently using operating system commands.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Mar 2013 18:24:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-comparing-file-size-of-files-in-a-directory/m-p/130399#M26592</guid>
      <dc:creator>DBailey</dc:creator>
      <dc:date>2013-03-07T18:24:28Z</dc:date>
    </item>
    <item>
      <title>Re: Help comparing file size of files in a directory.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-comparing-file-size-of-files-in-a-directory/m-p/130400#M26593</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;sorry..just saw the no pipes requirement.&amp;nbsp; Can you execute batch files?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Mar 2013 18:25:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-comparing-file-size-of-files-in-a-directory/m-p/130400#M26593</guid>
      <dc:creator>DBailey</dc:creator>
      <dc:date>2013-03-07T18:25:23Z</dc:date>
    </item>
    <item>
      <title>Re: Help comparing file size of files in a directory.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-comparing-file-size-of-files-in-a-directory/m-p/130401#M26594</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm not sure If I can. I can tell you I'm running SAS EG on a windows XP system. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Mar 2013 18:32:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-comparing-file-size-of-files-in-a-directory/m-p/130401#M26594</guid>
      <dc:creator>Jsendzik</dc:creator>
      <dc:date>2013-03-07T18:32:03Z</dc:date>
    </item>
    <item>
      <title>Re: Help comparing file size of files in a directory.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-comparing-file-size-of-files-in-a-directory/m-p/130402#M26595</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm writing a batch file now to see if I can use them&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Mar 2013 18:37:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-comparing-file-size-of-files-in-a-directory/m-p/130402#M26595</guid>
      <dc:creator>Jsendzik</dc:creator>
      <dc:date>2013-03-07T18:37:09Z</dc:date>
    </item>
    <item>
      <title>Re: Help comparing file size of files in a directory.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-comparing-file-size-of-files-in-a-directory/m-p/130403#M26596</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Okay just wrote one that would ping google. It worked fine. Yes I can execute batch files.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Mar 2013 18:40:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-comparing-file-size-of-files-in-a-directory/m-p/130403#M26596</guid>
      <dc:creator>Jsendzik</dc:creator>
      <dc:date>2013-03-07T18:40:05Z</dc:date>
    </item>
    <item>
      <title>Re: Help comparing file size of files in a directory.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-comparing-file-size-of-files-in-a-directory/m-p/130404#M26597</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So for all files on your c: drive, you could execute a batch program which gets a directory listing:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;dir /s c:\ *.* &amp;gt; listing.txt&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and then read listing.txt to parse out directory names, file names, and file sizes.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Mar 2013 19:09:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-comparing-file-size-of-files-in-a-directory/m-p/130404#M26597</guid>
      <dc:creator>DBailey</dc:creator>
      <dc:date>2013-03-07T19:09:22Z</dc:date>
    </item>
    <item>
      <title>Re: Help comparing file size of files in a directory.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-comparing-file-size-of-files-in-a-directory/m-p/130405#M26598</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks ill try this now. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Mar 2013 19:18:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-comparing-file-size-of-files-in-a-directory/m-p/130405#M26598</guid>
      <dc:creator>Jsendzik</dc:creator>
      <dc:date>2013-03-07T19:18:44Z</dc:date>
    </item>
    <item>
      <title>Re: Help comparing file size of files in a directory.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-comparing-file-size-of-files-in-a-directory/m-p/130406#M26599</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here's some code that I've used for a while. You may need to change the date and time informats, as the "dir" command uses your system settings.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tom&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data dirlist;&lt;/P&gt;&lt;P&gt;length test_rec $ 4096;&lt;/P&gt;&lt;P&gt;retain vol_let vol_name vol_ser dir_name first_dir;&lt;BR /&gt;length dir_name first_dir $ 1024;&lt;BR /&gt;length file_name $ 256;&lt;BR /&gt;length file_prefix $ 256;&lt;BR /&gt;length file_ext $ 256;&lt;BR /&gt;format file_date yymmdd10.;&lt;BR /&gt;format file_time time5.;&lt;/P&gt;&lt;P&gt;drop test_rec num_dots num_slash;&lt;/P&gt;&lt;P&gt;infile "C:\listing.txt";&lt;BR /&gt;input;&lt;/P&gt;&lt;P&gt;test_rec = _infile_;&lt;/P&gt;&lt;P&gt;if substr(test_rec, 1, 1) ^= " " then&lt;BR /&gt;do;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; if substr(test_rec, 25, 5) = "&amp;lt;DIR&amp;gt;" | substr(test_rec, 25, 10) = "&amp;lt;JUNCTION&amp;gt;" then; else&lt;BR /&gt;&amp;nbsp;&amp;nbsp; do;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; file_date = input(substr(test_rec, 1, 10), ddmmyy10.);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; file_time = input(substr(test_rec, 13, 8), time8.);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; file_size = input(substr(test_rec, 22, 17), comma17.);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; file_name = substr(trim(test_rec), 40);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; num_dots = countc(file_name, ".", "o");&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if num_dots = 1 then&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; do;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; file_prefix = scan(file_name, 1, ".");&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; file_ext = scan(file_name, 2, ".");&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end; else&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if num_dots = 0 then&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; do;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; file_prefix = file_name;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; file_ext = "";&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end; else&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; do;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; file_prefix = reverse(scan(reverse(file_name), 2, "."));&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; file_ext = reverse(scan(reverse(file_name), 1, "."));&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; end;&lt;BR /&gt;end; else&lt;/P&gt;&lt;P&gt;if substr(test_rec, 1, 14) = " Directory of " then&lt;BR /&gt;do;&lt;BR /&gt;&amp;nbsp; dir_name = substr(trim(test_rec), 15);&lt;BR /&gt;&amp;nbsp; num_slash = countc(dir_name, "\", "o");&lt;BR /&gt;&amp;nbsp; if num_slash = 1&lt;BR /&gt;&amp;nbsp; then first_dir = dir_name;&lt;BR /&gt;&amp;nbsp; else first_dir = scan(dir_name, 1, "\")||"\"||scan(dir_name, 2, "\");&lt;BR /&gt;end; else&lt;/P&gt;&lt;P&gt;if substr(test_rec, 1, 17) = " Volume in drive " then&lt;BR /&gt;do;&lt;BR /&gt;&amp;nbsp; vol_let = substr(test_rec, 18, 1);&lt;BR /&gt;&amp;nbsp; vol_name = substr(trim(test_rec), 23);&lt;BR /&gt;end; else&lt;/P&gt;&lt;P&gt;if substr(test_rec, 1, 25) = " Volume Serial Number is " then&lt;BR /&gt;do;&lt;BR /&gt;&amp;nbsp; vol_ser = substr(trim(test_rec), 26);&lt;BR /&gt;end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Mar 2013 16:23:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-comparing-file-size-of-files-in-a-directory/m-p/130406#M26599</guid>
      <dc:creator>TomKari</dc:creator>
      <dc:date>2013-03-08T16:23:27Z</dc:date>
    </item>
    <item>
      <title>Re: Help comparing file size of files in a directory.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-comparing-file-size-of-files-in-a-directory/m-p/130407#M26600</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks a bunch. I'll try this out now. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Mar 2013 16:26:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-comparing-file-size-of-files-in-a-directory/m-p/130407#M26600</guid>
      <dc:creator>Jsendzik</dc:creator>
      <dc:date>2013-03-08T16:26:09Z</dc:date>
    </item>
    <item>
      <title>Re: Help comparing file size of files in a directory.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-comparing-file-size-of-files-in-a-directory/m-p/130408#M26601</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A __default_attr="379045" __jive_macro_name="user" class="jive_macro jive_macro_user" data-objecttype="3" href="https://communities.sas.com/"&gt;&lt;/A&gt; I noticed that you have an in-file statement in the top portion. Is this a text document that lists all files within the directory? Or is that the file input i.e. what we eventually get output for.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Mar 2013 16:38:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-comparing-file-size-of-files-in-a-directory/m-p/130408#M26601</guid>
      <dc:creator>Jsendzik</dc:creator>
      <dc:date>2013-03-08T16:38:37Z</dc:date>
    </item>
    <item>
      <title>Re: Help comparing file size of files in a directory.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-comparing-file-size-of-files-in-a-directory/m-p/130409#M26602</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In &lt;A __default_attr="246082" __jive_macro_name="user" class="jive_macro jive_macro_user" data-objecttype="3" href="https://communities.sas.com/"&gt;&lt;/A&gt;'s post, the "dir /s c:\ *.* &amp;gt; listing.txt" will create a file named listing.txt that contains the results of the "dir" statement, in other words a listing of all of the files on the disk.&lt;/P&gt;&lt;P&gt;In my code, the "infile "C:\listing.txt";" statement will establish this as the file that I read the directory information from, in the "input;" statement. Using an input statement with just a semicolon will read a record, and store it in a variable named _infile_, which I then copy to test_rec and parse.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Mar 2013 19:01:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-comparing-file-size-of-files-in-a-directory/m-p/130409#M26602</guid>
      <dc:creator>TomKari</dc:creator>
      <dc:date>2013-03-08T19:01:54Z</dc:date>
    </item>
    <item>
      <title>Re: Help comparing file size of files in a directory.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-comparing-file-size-of-files-in-a-directory/m-p/130410#M26603</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I did not make that connection at all. That was a complete AHHAA moment. Thanks for your help.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Mar 2013 19:13:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-comparing-file-size-of-files-in-a-directory/m-p/130410#M26603</guid>
      <dc:creator>Jsendzik</dc:creator>
      <dc:date>2013-03-08T19:13:59Z</dc:date>
    </item>
    <item>
      <title>Re: Help comparing file size of files in a directory.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-comparing-file-size-of-files-in-a-directory/m-p/130411#M26604</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;WOW WOW Wow. Thank you all so much it works and I got to start learning about .bat files. I'm now one step closer to becoming an even lazier programmer. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Mar 2013 19:45:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-comparing-file-size-of-files-in-a-directory/m-p/130411#M26604</guid>
      <dc:creator>Jsendzik</dc:creator>
      <dc:date>2013-03-08T19:45:58Z</dc:date>
    </item>
  </channel>
</rss>

