! dir.tes - creates a directory file called allfiles.dir ! ! Q-Register usage: ! ! A.num = temporary to hold file attribute ! ! A.str = macro to process file attribute ! ! B.str = blanks ! ! D.num = temp used in D.str ! ! D.str = found directory process ! ! G.num = grand total of files in and below current directory ! ! L.num = number of lines outputed (for form-feed calculateion) ! ! N.num = scratch used by N.str ! ! N.str = macro to format number (file size) ! ! S.num = sub total of file sizes in current directory ! ! S.str = path\*.* of current directory ! ! T.str = list of months ! !dir.tec! @^UA~ ! load A.str ! QA-32"E ! if only archive ! @I%a% ! insert "a" ! F> ! exit macro ! ' ! endif ! QA&128"N @I%7% ' ! iif reserved attribute bit 7 insert "7" ! QA&64"N @I%6% ' ! iif reserved attribute bit 6 insert "6" ! QA&32"N @I%a% ' ! iif archived insert "a" ! QA&16"N @I%d% ' ! iif subdirectory insert "d" ! QA&8"N @I%v% ' ! iif Volume label insert "v" ! QA&4"N @I%s% ' ! iif system file insert "s" ! QA&2"N @I%h% ' ! iif hidden file insert "h" ! QA&1"N @I%r% ' ! iif read only file insert "r" ! ~ ! end load A.str ! @^UB% % @^UN# ! Load N.str ! \ ! insert entry arg into text buffer ! .+^SUN ! put position in front of arg into N.num ! -^S-1/3< ! loop for number of commas to insert ! 3R ! backup 3 chars ! @I%,% ! insert the comma ! R ! backup over the comma ! > ! end loop ! ZJ ! go to end of buffer ! ::C-48UT ! T.num = difference between current col and 48 ! QNJ ! jump in front of number ! QT"L ! if current col less than 48 ! GB ! get the blanks ! ^S-QTD ! (-len of blanks)-(-difference to col 48)D ! ZJ ! back to end of buffer ! F> ! exit macro ! ' ! endif current col less than 48 ! @I% % ! insert one blank ! ZJ ! go to end of buffer ! # ! end load of N.str ! ! T.str = list of months (0:15) ! ! v 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 ! @^UT%.badJANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDECbadbadbad% ! D.str = directory found process ! @^UD# ! Load D.str ! .UD ! remember . so we don't have to search for it ! G* ! get file spec buffer ! -^S,-:@S%\%"F ! if "\" NOT found (searching backwards) ! QDJ ! goto beginning line ! ' ! endif ! 0A-^^."N ! if last filespec on line NOT ".???????.???" ! QD,ZK ! kill the directory filespec (no ^YK here) ! [G ! push the grand total ! [S ! push the sub total and path ! 0UG ! zero the grand total ! 0US ! zero the sub total ! 31::@EN%\*.*% ! tack on "\*.*" attr: D V S H R ! G* ! get the new filespec ! ^YXS ! copy to S.str ! ' ! endif ! QD,ZK ! kill the directory filespec (no ^YK here) ! # ! End Load D.str ! ! macros are loaded now let's do some initialization prior to process ! @EW%allfiles.dir% ! directory listing goes to here ! < ! loop ! -:@EN%%; ! pop any stacked ENfilespecs$ ! > ! endloop ! 0W ! set screen window to 0 lines ! 31@EN%\*.*% ! initial wild card "\*.*" attr: D V S H R ! G* ! get copy of filespec ! ^YXS ! copy to S.str ! ^YK ! kill it out of the buffer ! 0UL ! clear line counter ! 0UG ! clear grand total counter ! 0US ! clear sub total counter ! < ! outer loop ! < ! inner loop ! :@EN%%; ! find next file on current level else exit ! 1,@EN%%&16"N ! if attribute says "subdirectory" ! MD ! perform subdirectory process ! F< ! continue ! ' ! endif subdirectory ! G* ! get filespec buffer ! 4,@EN%%MN ! get filesize and format with commas ! QN%G$ ! add filesize to grand total ! QN%S$ ! add filesize to sub total ! @I% % ! insert sepperating blank ! 3,@EN%%&31\ ! get date, mask out day, insert into buffer ! ^S+1"E ! if day was single digit ! R ! backup in front of it ! @I% % ! stick in an extra blank ! C ! advance past the day ! ' ! endif ! @I%-% ! dd- ! 3,@EN%%/32&15*3UD ! put month*3 # into D.num ! %DQT@I%% ! incriment D.num, index T.str (months) insert! ! dd-m ! %DQT@I%% ! incriment D.num, index T.str (months) insert! ! dd-mm ! %DQT@I%% ! incriment D.num, index T.str (months) insert! ! dd-mmm ! @I%-% ! dd-mmm- ! 3,@EN%%/512+80\ ! get date, extract year, convert, insert ! ^S+3"E ! if past 99 ! ^SC ! backup to 1nn ! D ! delete the 1 ! CC ! advance past the nn ! ' ! endif ! @I% % ! padd with 2 blanks ! 2,@EN%%/2048\ ! get the hour of last change, insert ! ^S+1"E ! if single digit ! R ! backup ! @I% % ! insert extra blank ! C ! advance ! ' ! endif ! @I%:% ! hh: ! 2,@EN%%/32&63\ ! get the time, exract the minutes, insert ! ^S+1"E ! if single digit ! R ! backup ! @I%0% ! insert leading 0 ! C ! advance ! ' ! endif ! @I%:% ! hh:mm: ! 2,@EN%%&31*2\ ! get the time, extract seconds(/2), cnv, ins ! ^S+1"E ! if single digit ! R ! backup ! @I%0% ! insert leading 0 ! C ! advance ! ' ! endif ! @I% % ! blank ! 1,@EN%%UA ! get the attributes, store in A.num ! QA"N MA ' ! iif any attributes, process them ! @I% % ! finaly insert ! ZJ-T ! type out the line ! %L-59"L ! if incriment # lines .lt. 59 ! F< ! continue ! ' ! endif ! PW ! punch buffer with ! HK ! kill buffer ! 0UL ! zero line counter ! > ! end loop ! GS ! get directory name ! QSMN ! get subtotal, formatted with commas ! @I% % ! insert ! GS ! get directory again ! -@FS%\%\...\% ! replace last \ with enleader ...'s ! ZJ ! back to end of buffer ! QGMN ! format grand total (for all sub directories) ! @I% % ! insert ! 3%L$ ! add 3 to line count, throw out result ! -3T ! type out ! -:@EN%%; ! pop directory level, exit if no more ! ]S ! pop upper level \path ann subtotal ! ]A ! pop upper level grand total ! QA%G$ ! add upper level grand total to grand total ! QL-59"L ! if not at end of page ! F< ! continue ! ' ! endif ! PW ! punch buffer with ! HK ! kill buffer ! 0UL ! zero line counter ! > ! end major loop ! EC ! close out allfiles.dir ! 20W ! restore window to 20 lines !