home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 6 File / 06-File.zip / vgo11a.zip / GO.CMD < prev    next >
OS/2 REXX Batch file  |  1994-01-25  |  32KB  |  1 lines

  1. /* GO.CMD Copyright (c)1993-94 M.O.S.E.S./Kari Jackson */;/* Type GO /? for complete syntax information. */;'@echo off';parse arg PARMS;if (PARMS='')|(PARMS='?')|(PARMS='/?')|(PARMS='-?') then signal Syntax;select;when left(PARMS,1)='"' then do;parse var PARMS . '"' COMMAND '"' PARMS;command='"'command'"';end;when left(PARMS,1)="'" then do;parse var PARMS . "'" COMMAND "'" PARMS;command='"'command'"';end;otherwise parse var parms command parms;end;if verify(command,'?*/','M')>0 then do;say "   The name of the command  you want GO.CMD";say "   to execute cannot contain the characters";say "   ?, *, or /.";signal Thanks;end;envvar=translate(value('GO-OP',,'OS2ENVIRONMENT'));deleteenv='';deleteparm='';do i=1 to words(envvar);envword=substr(word(envvar,i),2);if left(envword,2)=='CH'|left(envword,2)='CT' then do;say "   The GO-OP environment variable must not";say "   contain /CH, /CT, -CH, or -CT.";signal Thanks;end;do j=1 to words(parms);if substr(word(parms,j),2,1)='-' then do;parmword=translate(substr(word(parms,j),3));if abbrev(envword,parmword) then do;select;when left(parmword,2)='LT' then do ; deleteenv=deleteenv i ; deleteparm=deleteparm j ; end;when left(parmword,1)='L'&substr(envword,2,1)<>'T' then do ; deleteenv=deleteenv i ; deleteparm=deleteparm j ; end;when left(parmword,1)='L' then nop;when left(parmword,2)='DS' then do ; deleteenv=deleteenv i ; deleteparm=deleteparm j ; end;when left(parmword,1)='D'&substr(envword,2,1)<>'S' then do ; deleteenv=deleteenv i ; deleteparm=deleteparm j ; end;when left(parmword,1)='D' then nop;otherwise do ; deleteenv=deleteenv i ; deleteparm=deleteparm j ; end;end;end;end;end;end;do i = words(deleteenv) to 1 by -1;envvar=delword(envvar,word(deleteenv,i),1);end;do i = words(deleteparm) to 1 by -1;parms=delword(parms,word(deleteparm,i),1);end;envvar=strip(envvar);parms=strip(parms);if envvar<>'' then parms=envvar parms;drop envvar envword parmword deleteenv deleteparm;do while PARMS<>'';select;when left(PARMS,1)='"' then parse var PARMS . '"' SPEC '"' PARMS;when left(PARMS,1)="'" then parse var PARMS . "'" SPEC "'" PARMS;when left(parms,3)='/CH' then parse var parms . '/CH' head '/CH' parms;when left(parms,3)='-CH' then parse var parms . '-CH' head '-CH' parms;when left(parms,3)='/CT' then parse var parms . '/CT' TAIL '/CT' parms;when left(parms,3)='-CT' then parse var parms . '-CT' TAIL '-CT' parms;when left(parms,3)='/ch' then parse var parms . '/ch' head '/ch' parms;when left(parms,3)='-ch' then parse var parms . '-ch' head '-ch' parms;when left(parms,3)='/ct' then parse var parms . '/ct' TAIL '/ct' parms;when left(parms,3)='-ct' then parse var parms . '-ct' TAIL '-ct' parms;otherwise do;parse var parms this parms;if verify(left(this,1),'/-','M')>0 then do;this=translate(this);select;when substr(this,2)='1' then onelong='YES';when substr(this,2)='N' then do;fileonly='YES';changedir='YES';end;when substr(this,2)='Y' then all='YES';when substr(this,2)='C' then changedir='YES';when substr(this,2,1)='X' then exclude=substr(this,2);when substr(this,2)='P' then pause='YES';when substr(this,2)='S' then command='start /c' command;when substr(this,2)='F' then floppy='YES';when substr(this,2,1)='O' then do;only=strip(substr(this,3),,':');if length(only)<>1 | datatype(only,'U')=0 then do;say "   There can only be one character attached";say "   to GO.CMD's /O switch,  and it must be a";say "   drive letter.   For example, /OC or /OE.";signal Thanks;end;if only='A' | only='B' then floppy='YES';end;when substr(this,2)='DS' then thisdirsubs='YES';when substr(this,2)='D' then thisdir=YES;when substr(this,2,1)='A' then attribs=substr(this,3);when substr(this,2,2)='LT' then do;smaller=substr(this,4);testing=right(smaller,1);if testing='M'|testing='K' then smaller=left(smaller,length(smaller)-1);if testing='M' then testing=1048576;if testing='K' then testing=1024;if smaller='' | datatype(smaller)<>'NUM' then do;say "   Attached to GO.CMD's /LT switch must be a";say "   number referring to file size.";signal Thanks;end;if length(testing)>1 then smaller=smaller*testing;drop testing;end;when substr(this,2,2)='GT' then do;larger=substr(this,4);testing=right(larger,1);if testing='M'|testing='K' then larger=left(larger,length(larger)-1);if testing='M' then testing=1048576;if testing='K' then testing=1024;if larger='' | datatype(larger)<>'NUM' then do;say "   Attached to GO.CMD's /GT switch must be a";say "   number referring to file size.";signal Thanks;end;if length(testing)>1 then larger=larger*testing;drop testing;end;when substr(this,2,1)='L' then do;after=substr(this,3);select;when after='' then after='error';when left(after,1)='-' then after=julian(substr(after,2));otherwise after=getdate(after);end;drop month number year day prev leap now;if after='error' then do;say "   Attached to GO.CMD's /L switch must be some";say "   sort of number.  The number can be ""-0"" for";say "   today's files (since today minus zero means";say "   today) or ""-25"" for files since 25 days ago";say "   or anything up to ""-365"" for files from the";say "   past year.  Or the number can be a date.  A";say "   date can be specified as 7/24/93,  7-24-93,";say "   or 072493.   Notice that if no separator is";say "   used, then there must be two digits for the";say "   month and two for the day,  even for months";say "   and days less than 10.  The numbers must be";say "   presented in the order  Month,  Day,  Year.";signal Thanks;end;if left(after,2)>79 then after='19'after;else after='20'after;end;when substr(this,2,1)='E' then do;before=substr(this,3);select;when before='' then before='error';when left(before,1)='-' then before=julian(substr(before,2));otherwise before=getdate(before);end;drop month number year day prev leap now;if before='error' then do;say "   Attached to GO.CMD's /E switch must be some sort";say "   of number.  The number can be ""-1"" for files be-";say "   fore today (since today minus one equals yester-";say "   day)  or ""-25"" for files before 25 days ago,  or";say "   anything up to ""-365"" for files more than a year";say "   old.  Or the number can be a date.  The date can";say "   be specified as 7/24/93, 7-24-93, or 072493.  Be";say "   sure to remember  that when you don't use a - or";say "   / separator, then you have to use two digits for";say "   the month  and two digits for the day,  even for";say "   months and days less than ten.   And the numbers";say "   must be presented in the order Month, Day, Year.";signal Thanks;end;if left(before,2)>79 then before='19'before;else before='20'before;end;otherwise do;say "   You have used a command line switch that";say "   GO.CMD does not recognize.   The problem";say "   is most likely either  simple typograph-";say "   ical error,  or else you  have forgotten";say "   to use /CH or /CT  with a switch that is";say "   to be passed to  the command that GO.CMD";say "   is supposed to execute for you.";signal Thanks;end;end;end;else do;if spec<>'SPEC' then do;say "   You have used a command line switch that";say "   GO.CMD does not recognize.   The problem";say "   is most likely either  simple typograph-";say "   ical error,  or else you  have forgotten";say "   to use /CH or /CT  with a switch that is";say "   to be passed to  the command that GO.CMD";say "   is supposed to execute for you.";signal Thanks;end;else SPEC=this;end;end;end;parms=strip(parms);end;drop parms this;if BEFORE<>"BEFORE"&AFTER<>"AFTER"&AFTER>BEFORE then do;say "   The date on the /L switch can't be later";say "   than the date on the /E switch.";signal Thanks;end;if LARGER<>'LARGER'&SMALLER<>'SMALLER'&LARGER>SMALLER then do;say "   The number on the /GT switch can't be larger";say "   than the number on the /LT switch.";signal Thanks;end;if head='HEAD' then head='';if TAIL='TAIL' then TAIL='';if spec='SPEC' | spec='' then SPEC='*.*';if left(spec,1)='.' then spec='*'spec;if verify(spec,'.*','M')=0 then spec=spec'*.*';if verify(spec,'\','M')>0 then do;say "   The file  specification  cannot  contain";say "   a backslash.";signal Thanks;end;if only<>"ONLY"&thisdir="YES" then do;say "   The /O switch cannot be used with the /D";say "   switch.";signal Thanks;end;system='-';hidden='-';read='-';archive='*';if attribs<>'ATTRIBS' then do until attribs='';parse var attribs that 3 attribs;select;when that='+A' then archive='+';when that='-A' then archive='-';when that='+R' then read='+';when that='-R' then read='-';when that='+H' then hidden='+';when that='-H' then hidden='-';when that='+S' then system='+';when that='-S' then system='-';when that='*A' then archive='*';when that='*R' then read='*';when that='*H' then hidden='*';when that='*S' then system='*';otherwise do;say "   The only things  that can be attached to";say "   GO.CMD's  /A switch  are +A, -A, +R, -R,";say "   +H,  -H, +S,  -S, *A,  *R,  *H,  and *S,";say "   alone or in a logical combination.";signal Thanks;end;end;end;attribs=archive||'-'||hidden||read||system;drop archive hidden system read that;if rxfuncquery(sysloadfuncs) then do;call rxfuncadd sysloadfuncs, rexxutil, sysloadfuncs;call sysloadfuncs;end;call syscls;select;when thisdirsubs='THISDIRSUBS' & thisdir='THISDIR' & only='ONLY' then do;if all='ALL' then do;call lineout con,'GO.CMD Copyright (c)1993-94 M.O.S.E.S./Kari Jackson.  All rights reserved.';call lineout con,"Searching.  Please wait....";end;if floppy='FLOPPY' then good=sysdrivemap();else good=sysdrivemap('A:');if exclude<>'EXCLUDE' then do i = 1 to length(exclude);rc=wordpos(substr(exclude,i,1)':',good);if rc>0 then good=space(delword(good,rc,1),1);end;drives='';do v=1 to words(good);drives=space(drives word(sysdriveinfo(word(good,v)),1),1);end;drop good exclude floppy;find.0=0;do i = 1 to words(drives);parse var drives this drives;call sysfiletree this'\'SPEC, 'temp', 'FST', attribs;do m=1 to temp.0;find.0=find.0+1;l=find.0;find.l=temp.m;end;end;call DoIt;end;when only<>'ONLY' then do;if sysdriveinfo(only)='' then do;say "   Sorry, that drive is not accessible at the moment.";signal Thanks;end;if all='ALL' then do;call lineout con,'GO.CMD Copyright (c)1993-94 M.O.S.E.S./Kari Jackson.  All rights reserved.';call lineout con,"Searching.  Please wait....";end;call sysfiletree only':\'SPEC, 'find', 'FST', attribs;call DoIt;end;when thisdir='YES' then do;if all='ALL' then do;call lineout con,'GO.CMD Copyright (c)1993-94 M.O.S.E.S./Kari Jackson.  All rights reserved.';call lineout con,"Searching.  Please wait....";end;call sysfiletree SPEC, 'find', 'FT', attribs;call DoIt;end;when thisdirsubs='YES' then do;if all='ALL' then do;call lineout con,'GO.CMD Copyright (c)1993-94 M.O.S.E.S./Kari Jackson.  All rights reserved.';call lineout con,"Searching.  Please wait....";end;call sysfiletree SPEC, 'find', 'FST', attribs;call DoIt;end;otherwise nop;end;exit;Syntax:;SAY '     GO.CMD lets you perform any command on files according to their dates,';SAY '     sizes, and/or attributes,  and it also lets you perform a command on a';SAY '     file in a different directory without specifying the directory''s name.';SAY '';SAY '     SWITCHES WHICH DEFINE THE FILES TO ACT UPON';SAY '';SAY '     /A  Attributes  (default is /A*A-H-R-S)';SAY '        +A, +H, +R, +S  only files with those attributes';SAY '        -A, -H, -R, -S  only files without those attributes';SAY '        *A, *H, *R, *S  all files regardless of those attributes';SAY '';SAY '     /E  Earlier';SAY '        /E071093  07/10/93 and earlier  or   /E-25  25 days ago and earlier';SAY '     /L  Later';SAY '        /L071993  07/19/93 and later    or     /L-25  25 days ago and later';SAY '';SAY '     /LT  Less Than';SAY '        /LT1024  files of 1024 bytes and smaller';SAY '        /LT1K  files of 1 kilobyte and smaller';SAY '     /GT  Greater Than';SAY '        /GT1048576  files of 1048576 bytes and larger';SAY '        /GT1M  files of 1 megabyte and larger';SAY '';SAY '           Press <Enter> to continue....';pull ans;SAY '   SWITCHES WHICH DEFINE THE DRIVES/DIRECTORIES TO SEARCH';SAY '     /D  Directory';SAY '     /DS  Directory and Subdirectories';SAY '        only files in  the current directory,  or it and its subdirectories';SAY '     /F  Floppies';SAY '        include floppy drives in the search (if they contain disks)';SAY '     /O  Only';SAY '        /OE  search drive E: only';SAY '     /X  eXclude drive letters';SAY '        /XEH  to have GO ignore drives E: and H:';SAY '   SWITCHES WHICH MODIFY GO.CMD''S BEHAVIOR';SAY '     /1  One long command';SAY '        execute just one command, with all the selected filenames as param-';SAY '        eters, rather than one command for each filename';SAY '     /C  Change directory';SAY '        change to each file''s directory before executing each command';SAY '     /N  No full file specification';SAY '        pass just [file.ext] to the command,  rather than [d:\dir\file.ext]';SAY '     /P  Pause';SAY '        pause between executions when more than one filename is selected';SAY '     /S  START command';SAY '        to have GO insert "START /C" before the name of the command';SAY '     /Y  Yes, select all the matching files without asking';SAY '           Press <Enter> to continue....';pull ans;SAY '     PASSING PARAMETERS TO THE FINAL COMMAND';SAY '     /CH  Command Head';SAY '     /CT  Command Tail';SAY '        /CT A:\DIRNAME /V /CT  would pass the parameters "A:\DIRNAME /V" to';SAY '        the command, after the name of the selected file.   If your command';SAY '        wants any parameters other than the filename itself,  and they need';SAY '        to go after the filename,  then you surround  those parameters with';SAY '        /CT switches (or -CT switches as long as they both match--don''t use';SAY '        /CT for the first one and -CT for the second!)  on GO.CMD''s command';SAY '        line.  If the "/CT stuff /CT" is the last thing on GO.CMD''s command';SAY '        line, then you can leave off the second /CT.  If your command wants';SAY '        parameters that go before the filename rather than after,  then you';SAY '        surround those parameters with /CH''s  rather than /CT''s on GO.CMD''s';SAY '        command line, and all the other /CT rules also apply to /CH.';SAY '     EXAMPLE';SAY '        GO COPY *.INI /F /L070193 /E073193 /A-A*R /CT A: /V';SAY '     would search all your drives including floppies (/F),  for *.INI files';SAY '     with dates of July, 1993 (/L070193 /E073193) that have no Archive att-';SAY '     ributes (/A-A),  including ones with Read-only attributes (/A*R),  and';SAY '     allow you to select the files you want from that list.   Then it would';SAY '     execute the command:';SAY '        COPY [d:\path\filename.ext] A: /V';SAY '     (because "A: /V" comes after "/CT")  once for each filename you chose.';SAY '           Do you want more information?  (y/N)';pull ans;if ans<>'Y' then exit;SAY '     If you don''t specify any filename, GO.CMD will assume "*.*".   If your';SAY '     file specification does not contain a "." or "*" character then GO.CMD';SAY '     will add "*.*" to the end of it.  If your filespec begins with ".", GO';SAY '     will attach "*" to the beginning of it.';SAY '';SAY '     By default,  GO.CMD will search all drives,  C: and higher  (including';SAY '     CD-ROM drives when a data disk is present).   Use the /F switch if you';SAY '     want GO to also search the A: and/or B: drives  (if they have disks in';SAY '     them).   Use the /O switch when you want to search only one particular';SAY '     drive (as in /OC for just the C: drive, or /OF for just the F: drive).';SAY '     If you use /OA or /OB, then GO will automatically assume the /F switch';SAY '     so you need not specify it.   Use the /X switch if you want to exclude';SAY '     one or more specific drives from the search  (as in /XC to exclude the';SAY '     C: drive  or /XDFG to exclude the D:, F:, and G: drives).   Use the /D';SAY '     switch to search  only the current directory of the current drive,  or';SAY '     /DS to search only the current directory and its subdirectories.';SAY '';SAY '     Unless you use the /A switch  to specify otherwise,  GO will only find';SAY '     files without R,  H,  or S attributes since the default is /A*A-H-R-S.';SAY '     The /A switch allows you to tell GO  exactly what combinations of att-';SAY '     ributes you want included in the search.  The attributes are A for Ar-';SAY '     chive, H for Hidden,  R for Read-only,  and S for System,  and you use';SAY '     +, -, and * modifiers to specify  whether you want those attributes to';SAY '           Press <Enter> to continue....';pull ans;SAY '     be on, off,  or you don''t care.   The + means the files must have that';SAY '     attribute turned on or GO.CMD will ignore them.  The - means the files';SAY '     must have that attribute turned off  or GO.CMD will ignore them.   And';SAY '     the * means  you want both groups of files---those that have that att-';SAY '     ribute turned on, and those that have it turned off.';SAY '';SAY '     /A-A*H*S would mean files without the A attribute, even including ones';SAY '     with H and S,  but not including those with R  since -R is part of the';SAY '     default  and /A-A*H*S doesn''t tell GO.CMD  anything different about R.';SAY '     /A-A*H*S*R would mean the same except that it would also include files';SAY '     with  the R attribute.   /A-A would mean  files without A, H, R, or S,';SAY '     since -H-R-S  is part of  the default.   /A+A+S would mean  files that';SAY '     have both A and S attributes  but do not have H or R  (because -H-R is';SAY '     part of the default).   /A+H-A would mean all non-read-only non-system';SAY '     non-archive files that have the H attribute.';SAY '';SAY '     You can use the /E and /L switches alone,  or in combination.   The /E';SAY '     switch means files with that date and earlier, and /L means files with';SAY '     that date and later.   If you use both switches, with the same date on';SAY '     each,  then you''ll get files with that date only.   Or if you use both';SAY '     switches with different dates (the later date on the /E switch),  then';SAY '     you''ll get all files with those dates  and any dates in between.   You';SAY '     can also use a negative number  instead of a date.   -25 means 25 days';SAY '           Press <Enter> to continue....';pull ans;SAY '     ago.  -0 means today.   -365 (the highest allowed) means one year ago.';SAY '';SAY '     When specifying dates, the month must be first, then the day, and then';SAY '     the year.  You may use / or - as separators if you wish.  If you don''t';SAY '     then you must use two digits for the month and two for the day even if';SAY '     you''re specifying January 5th.  For example, 010593 will work but 1593';SAY '     will not, even though 1/5/93 will.   When you use / or - as separators';SAY '     GO.CMD can tell what you mean  even if you use  only one digit for the';SAY '     month and day.';SAY '';SAY '     You can use the /LT and /GT switches alone or in combination.  The /LT';SAY '     switch means files with that size and smaller and /GT means files with';SAY '     that size and larger.  If you use both switches, with the same size on';SAY '     each, then you''ll get files with that exact size only.   Or if you use';SAY '     both switches with different sizes (the larger size on the /LT switch)';SAY '     you''ll get  all files with those sizes  and anything in between.   The';SAY '     number on  the /LT and /GT switches  is the number of bytes unless you';SAY '     specify K for kilobytes (1024 bytes) or M for megabytes (1024K).';SAY '';SAY '     Sometimes you want to  execute a command  from the directory that con-';SAY '     tains the file you''re using it on.  Or if you use the START command to';SAY '     run a program after GO finds its executable filename for you,  you may';SAY '     want to execute that command  from within the executable file''s direc-';SAY '           Press <Enter> to continue....';pull ans;SAY '     tory.  In cases like these, use the /C switch which tells GO to change';SAY '     to the directory that contains each selected file before executing the';SAY '     command with that filename parameter.';SAY '';SAY '     Some programs require the filename to contain just the filename itself';SAY '     without any  [d:\dirname\]  information.   And of course, in order for';SAY '     that to work,  the program must be executed  from within the directory';SAY '     that contains the file.  If you have such a program, use the /N switch';SAY '     to tell GO to pass only the [filename.ext] part to the command.   When';SAY '     /N is used, /C is automatically assumed so you need not specify it.';SAY '';SAY '     If you use the /P switch,  GO will execute your command with the first';SAY '     filename you selected, and then wait.  When you "Press any key", GO''ll';SAY '     execute the command with the next filename, etc.  So the command won''t';SAY '     be executing in more than one session at the same time even if you use';SAY '     the /S switch, and so you have an easier time of using Ctrl-C to break';SAY '     out of the routine if you change your mind during execution.';SAY '';SAY '     If you want your command  to execute in  a different session  than the';SAY '     one GO is running in,  use the /S switch  to tell GO to  use the START';SAY '     command.   But understand  that if you do that,  and then you select a';SAY '     dozen filenames  to execute your command with,  you''re telling OS/2 to';SAY '     start up a dozen new sessions.   Don''t do that if your computer can''t.';SAY '           Press <Enter> to continue....';pull ans;SAY '     Commands that are  good candidates  for use with GO.CMD  include COPY,';SAY '     DEL,  MOVE,  REN,  E(ditor),  VIEW; really just about any command that';SAY '     wants a filename as a parameter.   GO.CMD is very convenient for edit-';SAY '     ing files in faraway directories, copying groups of files in all sorts';SAY '     of combinations according to  dates and attributes,  and various other';SAY '     types of file maintenance.   Also,  it''s often useful to  use START as';SAY '     the command to execute, and that way you can execute a command without';SAY '     having it on the PATH or remembering where it''s located.';SAY '';SAY '     You can use an environment variable  named GO-OP to set default switch';SAY '     values for GO to use without being told each time.  See GO.DOC for de-';SAY '     tails.';SAY '';SAY '     When GO.CMD finds files that match your specifications,  it shows them';SAY '     on your screen along with instructions on what you can do with them:';SAY '              Type  ALL           to select  all of  these files.';SAY '              Type  <Enter>       to select  none of these files.';SAY '              Type  1 14 23 38    to select  some of these files.';SAY '              Type  14 - 23       to select  a  range  of  files.';SAY '              Type  - 1 14 23 38  to exclude some of these files.';SAY '              Type  - 14 - 23     to exclude  a range  of  files.';SAY '              Type  SKIP          to skip the rest of the search.';SAY '              Type  QUIT          to abort this entire operation.';SAY '           Press <Enter> to continue....';pull ans;SAY '     1 14 23 38 means that''s what you type  if you want to select the files';SAY '     that are displayed on the screen  next to those four numbers.   If you';SAY '     want only file #7, then you type just 7.  If you want files 12 and 27,';SAY '     you type 12 27.   The numbers in that display are only examples to re-';SAY '     mind you  what options you have.   They''re not to be  taken literally.';SAY '     And SKIP means that  you don''t want any  of the files on this page and';SAY '     you don''t want to continue the search.   You just want to go ahead and';SAY '     execute your command  with whatever files  you had  already  chosen on';SAY '     previous pages.   All of these options  apply only to  the files  dis-';SAY '     played on this particular page.   For example typing "ALL" chooses all';SAY '     the filenames  you see displayed  at the moment,  but has no effect on';SAY '     earlier or later pages of filenames.   QUIT exits the GO.CMD operation';SAY '     without executing any commands at all.';exit;DoIt:;drop spec thisdirsubs thisdir attribs drives this temp. only;if AFTER<>'AFTER'|BEFORE<>'BEFORE' then do i = 1 to find.0;filedate=space(translate(left(word(find.i,1),8),'','/'),0);if left(filedate,2)>79 then filedate='19'filedate;else filedate='20'filedate;if after<>'AFTER' & filedate < after then find.i='';if before<>'BEFORE' & filedate > before then find.i='';end;if larger<>'LARGER' | smaller<>'SMALLER' then do i = 1 to find.0;if find.i='' then iterate;if smaller<>'SMALLER' & word(find.i,2) > smaller then find.i='';if larger<>'LARGER' & word(find.i,2) < larger then find.i='';end;drop after before larger smaller filedate;found.0=0;do i = 1 to find.0;if find.i='' then iterate;found.0=found.0+1;o=found.0;found.o=find.i;end;drop find.;lasttime=1;parse value systextscreensize() with rows .;rows=rows-10;if all = 'ALL' then do i = 1 to found.0;if word(syscurpos(),1)=rows+9 then call syscls;say format(i,4)'.  'substr(found.i,4,2)'/'substr(found.i,7,2)'/'left(found.i,2)||format(word(found.i,2),10)'   'word(found.i,3)'   'subword(found.i,4);if (word(syscurpos(),1)>rows | i = found.0) then do;say "Type  ALL           to select  all of  these files.";say "Type  <Enter>       to select  none of these files.";say "Type  1 14 23 38    to select  some of these files.";say "Type  14 - 23       to select  a  range  of  files.";say "Type  - 1 14 23 38  to exclude some of these files.";say "Type  - 14 - 23     to exclude  a range  of  files.";if i<found.0 then say "Type  SKIP          to skip the rest of the search.   More filenames to come...";else say "Type  SKIP          to skip the rest of the search.   That's all the filenames.";say "Type  QUIT          to abort this entire operation.   Enter your selection now.";pull answer;select;when answer='ALL' then nop;when answer='QUIT' then do;do y = 1 to found.0;found.y='';end;leave i;end;when answer='SKIP' then do;do r=lasttime to found.0;found.r='';end;leave i;end;when left(answer,1)='-' & verify(substr(answer,2),'-','M')>0 then do;parse var answer '-' first '-' last;first=strip(first);last=strip(last);if first < lasttime | first > i | last < lasttime | last > i | first = last | first > last then do;say "   The numbers you use as the beginning and";say "   end of  the range  must be numbers  that";say "   are showing on your screen, and the sec-";say "   ond one  must be larger  than the first.";say "   Now try again.   ( <Enter> to continue.)";pull test;noadv='YES';end;else do r = first to last;found.r='';end;end;when left(answer,1)='-' then do r = lasttime to i;if wordpos(r,substr(answer,2))>0 then found.r='';end;when verify(answer,'-','M')>0 then do;parse var answer first '-' last;first=strip(first);last=strip(last);if first < lasttime | first > i | last < lasttime | last > i | first = last | first > last then do;say "   The numbers you use as the beginning and";say "   end of  the range  must be numbers  that";say "   are showing on your screen, and the sec-";say "   ond one  must be larger  than the first.";say "   Now try again.   ( <Enter> to continue.)";pull test;noadv='YES';end;else do r = lasttime to i;if r < first then found.r='';if r > last then found.r='';end;end;when answer='' then do r=lasttime to i;found.r='';end;otherwise do r = lasttime to i;if wordpos(r,answer)=0 then found.r='';end;end;if noadv<>'YES' then lasttime=i+1;else i=lasttime-1;drop noadv;end;end;drop rows lasttime answer first last test;command=translate(command);if wordpos('DEL',command)>0 | wordpos('ERASE',command)>0 then do i = 1 to found.0;if found.i='' then iterate;if verify(word(found.i,3),'HSR','M')>0 then call sysfiletree word(found.i,4), 'trash', 'F', '*-***', '**---';end;if onelong<>'YES' then do i = 1 to found.0;if found.i='' then iterate;if changedir='YES' then call directory left(subword(found.i,4),lastpos('\',subword(found.i,4))-1);if FILEONLY <> 'YES' then do;if words(subword(found.i,4)) > 1 then file='"'subword(found.i,4)'"';else file=subword(found.i,4);end;else do;if words(subword(found.i,4)) > 1 then file='"'filespec("name",subword(found.i,4))'"';else file=filespec("name",subword(found.i,4));end;'call' command head file tail;if pause='YES' then 'pause';end;else if found.0>0 then do;if changedir='YES' then call directory left(subword(found.1,4),lastpos('\',subword(found.1,4))-1);longfile='';do i = 1 to found.0;if found.i='' then iterate;if FILEONLY <> 'YES' then do;if words(subword(found.i,4)) > 1 then file='"'subword(found.i,4)'"';else file=subword(found.i,4);end;else do;if words(subword(found.i,4)) > 1 then file='"'filespec("name",subword(found.i,4))'"';else file=filespec("name",subword(found.i,4));end;longfile=longfile file;end;if longfile<>'' then 'call' command head||longfile tail;end;if found.0=0 then say '   No matching files found.';return;Julian:;arg number;if length(number)<1 | length(number)>3 | datatype(number)<>'NUM' | number>365 then return "error";now=date('S');if number=0 then do;month=substr(now,5,2);prev=right(now,2);end;else prev=date('D')-number;year=substr(now,3,2);if prev>0 & number<>0 then select;when prev<32 then do ; month='01' ; end;when prev<60 then do ; month='02' ; prev=prev-31 ; end;otherwise do;select;when year//4>0 then leap='NO';when year<>'00' then leap='YES';when left(now,2)//4=0 then leap='YES';otherwise leap='NO';end;if leap='YES' & prev<61 then do ; month='02' ; prev=29 ; end;else if leap='YES' then prev=prev-1;if month='MONTH' then select;when prev<91 then do ; month='03' ; prev=prev-59 ; end;when prev<121 then do ; month='04' ; prev=prev-90 ; end;when prev<152 then do ; month='05' ; prev=prev-120 ; end;when prev<182 then do ; month='06' ; prev=prev-151 ; end;when prev<213 then do ; month='07' ; prev=prev-181 ; end;when prev<244 then do ; month='08' ; prev=prev-212 ; end;when prev<274 then do ; month='09' ; prev=prev-243 ; end;when prev<305 then do ; month='10' ; prev=prev-273 ; end;when prev<335 then do ; month='11' ; prev=prev-304 ; end;otherwise do ; month='12' ; prev=prev-334 ; end;end;end;end;if prev<0 & number<>0 then do;prev=substr(prev,2);if year='00' then year='99';else year=year-1;select;when prev<31 then do ; month='12' ; end;when prev<61 then do ; month='11' ; prev=prev-31 ; end;when prev<92 then do ; month='10' ; prev=prev-61 ; end;when prev<122 then do ; month='09' ; prev=prev-92 ; end;when prev<153 then do ; month='08' ; prev=prev-122 ; end;when prev<184 then do ; month='07' ; prev=prev-153 ; end;when prev<214 then do ; month='06' ; prev=prev-184 ; end;when prev<245 then do ; month='05' ; prev=prev-214 ; end;when prev<275 then do ; month='04' ; prev=prev-245 ; end;when prev<306 then do ; month='03' ; prev=prev-275 ; end;otherwise do;select;when year//4>0 then leap='NO';when year<>'00' then leap='YES';when left(now,2)//4=0 then leap='YES';otherwise leap='NO';end;if leap='YES' then do;if prev<335 then do ; month='02' ; prev=prev-306 ; end;else do ; month='01' ; prev=prev-335 ; end;end;else do;if prev<334 then do ; month='02' ; prev=prev-306 ; end;else do ; month='01' ; prev=prev-334 ; end;end;end;end;if month='01' | month='03' | month='05' | month='07' | month='08' | month='10' | month='12' then prev=31-prev;if month='04' | month='06' | month='09' | month='11' then prev=30-prev;if month='02' & leap='YES' then prev=29-prev;if month='02' & leap='NO' then prev=28-prev;end;if prev=0 & number<>0 then do;month='12';prev='31';if year='00' then year='99';else year=year-1;end;return translate(format(year,2)||month||format(prev,2),'0',' ');GetDate:;arg number;select;when verify(number,'/','M')>0 then parse var number month '/' day '/' year;when verify(number,'-','M')>0 then parse var number month '-' day '-' year;otherwise parse var number month 3 day 5 year;end;if length(year)<>2 then return 'error';if datatype(month)<>'NUM' | datatype(day)<>'NUM' | datatype(year)<>'NUM' then return 'error';if month < 0 | month > 12 | day < 0 | day > 31 | year > 99 then return 'error';return translate(format(year,2)||format(month,2)||format(day,2),'0',' ');Thanks:;say "Type GO /? for complete syntax information.";exit;