@DATABASE "DirII.guide"
@$VER: DirII 3.3a (18.6.95)
@NODE Main "DirII - Contents"
                @{b}DirII v3.3a@{ub}

  © 1995 Stephen Davies - Freely distributable


             @{" Introduction   " link node_int}
             @{" Description    " link node_des}
             @{" File Types     " link node_ft}
             @{" LFORMAT String " link node_lf}
             @{" Examples       " link node_ex}
             @{" History        " link node_hist}
             @{" Credits        " link node_cre}

@ENDNODE

@NODE node_int "DirII - Introduction"
 @{b}What is it?@{ub}

   DirII is a replacement for DIR and LIST.

   DirII is CLI only and requires AmigaDOS Release 2 or later.


 @{b}Features@{ub}

   Can display in columns which adjust to size of the console window
   and to the width of the filenames.

   Uses ANSI codes to add colour and create what I think is a more
   readable display.

   Can execute "scripts" created using LFORMAT without the need
   to redirect to a file and use the execute command.

   More LFORMAT options than LIST.

   Can identify type (eg. "Executable") of a file.

   Can filter files not just by name and date, but also by type,
   size, protection flags and comment.

   Can sort by name, size, or date, (or by file, ie. unsorted)

   When sorting by name, DirII uses a more intelligent comparison routine
   than stricmp. For example "file2" displayed before "file13".

   Can display in columns which adjust to size of the console window
   and to the width of the filenames. (Worth mentioning twice, honest!)
@ENDNODE

@NODE node_des "DirII - Description"
 @{b}Synopsis@{ub}

   DirII [<dir>|<pattern>] [P | PAT <pattern>] [TP | TYPEPAT <pattern>]
   [FP | FLAGPAT <pattern> ] [CP | COMMENTPAT <pattern> ] [NI | NOINFO]
   [SINCE <date>] [UPTO <date>] [BIGGEST <number>] [SMALLEST <number>]
   [DIRS] [FILES] [MIX] [ALL] [MA | MULITASSIGNS] [KEYS] [SIZES] [TYPES]
   [FLAGS] [DATES] [COMMENTS] [NOANSI] [WIDTH <numcols>] [BLOCKS] [SUBST]
   [BF | BYFILE] [BS | BYSIZE] [BD | BYDATE] [DESC | DESCENDING]
   [LF | LFORMAT <string> [EXE | EXECUTE]]


 @{b}Template@{ub}

   DIR,P=PAT/K,TP=TYPEPAT/K,FP=FLAGPAT/K,CP=COMMENTPAT/K,NI=NOINFO/S,
   SINCE/K,UPTO/K,BIGGEST/K/N,SMALLEST/K/N,DIRS/S,FILES/S,MIX/S,ALL/S,
   MA=MULTIASSIGNS/S,KEYS/S,SIZES/S,TYPES/S,FLAGS/S,DATES/S,COMMENTS/S,
   NOANSI/S,WIDTH/K/N,BLOCKS/S,SUBST/S,BF=BYFILE/S,BS=BYSIZE/S,
   BD=BYDATE/S,DESC=DESCENDING/S,LF=LFORMAT/K,EXE=EXECUTE/S


 @{b}Specification@{ub}

            DIR: Path and/or file to display.

            PAT: Pattern which files' name must match.
        TYPEPAT: Pattern which files' type must match.
                 For example: "DirII TYPEPAT (ASCII|Amigaguide)"
                 See @{"FILE TYPES" link node_ft}
        FLAGPAT: Pattern which files' protection flags must match.
                 For example: "DirII FLAGPAT #?a#?"
     COMMENTPAT: Pattern which files' comment must match.

         NOINFO: Don't list .info files.
          SINCE: List only files created on or after specified date*.
           UPTO: List only files created on or before specified date*.
                 *Specify date in AmigaDOS format or as a number.
                  Eg. "SINCE 1" = "SINCE yesterday"
        BIGGEST: List only files that aren't larger than specified size.
       SMALLEST: List only files that aren't smaller than specified size.

           DIRS: Display directories but not files.
          FILES: Display files but not directories.
            MIX: Don't separate files and directories in output display.

            ALL: List files in all sub-directories.

   MULLIASSIGNS: Display the contents of all paths of a multiassign.

           KEYS: Display the block number of header block of file.
          SIZES: Display the size of file.
          TYPES: Display the type (eg. executable) of file.
                 See @{"FILE TYPES" link node_ft}
          FLAGS: Display the protection flags of file.
                 Also display 'C' flag if file contains a comment and
                  the COMMENTS option is not specifed.
          DATES: Display the creation time and date of file.
       COMMENTS: Display the comment, if one exists, of file. The comment
                 is placed on the following line and preceded by a colon.

         NOANSI: Disable ANSI escape codes.

          WIDTH: Width of the output in charcters, used when trying
                 to arrange the output into multiple columns.
                 If omitted, the width is determined by the console, so this
                 option is only useful if sending output to the printer, or
                 if forcing single-column output by using WIDTH=0.

         BLOCKS: Treat sizes as blocks, rather than bytes.

          SUBST: Substitute recent dates with "today", "monday", etc.

         BYFILE: Sort display by file order on disk (same as LIST).
         BYSIZE: Sort display by size.
         BYDATE: Sort display by date.
     DESCENDING: Sort display in descending order.

        LFORMAT: Format the output according to the specified string.
                 See @{"LFORMAT STRING" link node_lf}
        EXECUTE: Execute the output produced by LFORMAT.


 @{b}Notes@{ub}

   If MIX specified, and neither LFORMAT nor TYPES are specified,
   a slash (/) will be appended to directory names.

   If a filename contains a space, and LFORMAT is not specified,
   the filename will be displayed in quotes.

   If an empty string is supplied for any of the options PAT, TYPEPAT,
   FLAGPAT, COMMENTPAT or LFORMAT, the option will be ignored completely.
   This is to allow 'PAT="{PAT}"' in scripts. Ideally, the same would
   apply to BIGGEST and SMALLEST, but ReadArgs won't allow this.
@ENDNODE

@NODE node_ft "DirII - File Types"
 @{b}Recognised types@{ub}

   Directory
   Empty
   Executable
   Loadable
   Object
   Font
   Powerpacker
   GIF
   JPEG
   LhA
   LZX
   ASCII
   Amigaguide
   IFF-???? (???? is type of IFF)
   Icon-Drawer
   Icon-Project
   Icon-Tool
   Icon-Disk
   Icon-Trash
   Icon-Device
   Icon-Kick
   Unknown-???? (DirII searches for the first printable character, skipping
                 any occurrences of "$VER:", then displays 4 characters,
                 replacing non-printable characters with '.')


 @{b}Note@{ub}

    Be aware that the type of a file is determined by examining the first
    few characters of the file, which is not an infallible method.

    Also note that loadable refers to pseudo executable such as libraries,
    devices, etc., but some
@ENDNODE

@NODE node_lf "DirII - LFORMAT String"
 @{b}Formating codes@{ub}

   %a - @{u}A@{uu}ttributes (ie. protection bits)
   %b - Size in @{u}b@{uu}locks
   %c - @{u}C@{uu}omments
   %d - @{u}D@{uu}ate
   %e - Filename @{u}e@{uu}xtension part
   %f - @{u}F@{uu}ull (ie. expanded) path
   %j - Path and filename @{u}j@{uu}oined
   %k - @{u}K@{uu}ey
   %l - @{u}L@{uu}ength in bytes
   %m - Filename @{u}m@{uu}ain part
   %n - @{u}N@{uu}ame
   %p - @{u}P@{uu}ath
   %t - @{u}T@{uu}ime
   %w - @{u}W@{uu}ildcard matched part of filename (see below)
   %y - T@{u}y@{uu}pe
   %% - Percent sign (ie. %)


 @{b}Notes@{ub}

   The %s code is not supported as %f %n %p %j are much better.

   Length/justification specifiers may be included (eg. "%-8n").

   If the code is entered in upper case, the output is enclosed in quotes.


 @{b}%w@{ub}

   This switch specifies the part of the filename that was matched by
   wildcards in the PAT option.

   eg) DirII s: PAT=#?startup LFORMAT="%n ; %w"
       Shell-StartUp ; Shell-
       User-StartUp ; User-

   If PAT contains multiple wildcards, DirII will treat everything from
   the beginning of the first wildcard to the end of the last wildcard
   as one wildcard.

   eg) DirII PAT=abc?e[0-9]#?xyz LFORMAT="%n ; %w"
       abcde1.xyz ; de1.
       abcde2.wxyz ; de2.w
       abcde3xyz ; de3

@ENDNODE

@NODE node_ex "DirII - Examples"
 @{b}First a simple one just to show the neat column output.@{ub}

   1> DirII s: sizes
      Aliases               870  Assignments      1550  DPat          709
      PCD                   248  Shell-Startup      94  SPat          283
      startup-sequence     2866  ToolsDaemon.menu 6160  User-StartUp 1122
      Virus_Checker.config  108  Yak.hotkeys       218  Yak.prefs      84
     Files: 12 ; Directories: 0 ; Bytes: 14312 ; Blocks: 34


 @{b}Spot the difference between this...@{ub}

   1> DirII Sys:d#?/
   Sys:Devs/
    Files (6) ...
     clipboard.device  MountList       narrator.device
     parallel.device   printer.device  serial.device  

 @{b}and this...@{ub}

   1> DirII Sys:d#?
    Directories (1) ...
     Devs
    Files (2) ...
     Devs.info  Disk.info


 @{b}Here's what those switches do. Why not set up an alias for your@{ub}
 @{b}favourites. (The WIDTH=0 forces each entry to be on a new line)@{ub}

   1> DirII MIX SIZES TYPES FLAGS DATES WIDTH=0
     FixFonts        840 Executable   ----rwed 02-Sep-92 11:51:32
     FixFonts.info  4396 Icon-Tool    ----rw-d 23-Feb-94 20:10:14
     Format        12896 Executable   ----rwed 02-Sep-92 11:51:32
     Format.info    4387 Icon-Tool    ----rw-d 23-Feb-94 20:10:12
     LostDir/            Directory    ----rw-d 23-Aug-94 19:34:19
     Shell.info     4616 Icon-Project ----rw-d 23-Feb-94 20:10:13
    Files: 5 ; Directories: 1 ; Bytes: 27135 ; Blocks: 63


 @{b}This one finds all files which were created today,@{ub}
 @{b}using LFORMAT to produce a concise output.@{ub}

   1> DirII Work: LFORMAT "%j" SINCE today FILES ALL


 @{b}A simple batch rename command could be implemented@{ub}
 @{b}with the following script@{ub}

   .key FROM/A,TO/A,DIR/K,ALL/S
   .bra {
   .ket }
   DirII "{DIR}" PAT="{FROM}" LFORMAT="Rename %J *"%p{TO}*"" {ALL} EXECUTE

   1> BatchRen DIR=Pics: #?.iff %w.ilbm ALL ; Could have used %m or %w
   1> BatchRen #?.docs.INFO %w.doc.INFO     ; Had to use %w


 @{b}And finally, an example which copies to df0: all executable files@{ub}
 @{b}whose archive flag isn't set, then sets their archive flag.@{ub}

   1> DirII TYPEPAT Executable FLAGPAT ~(#?a#?) LFORMAT "Copy %N
   df0: CLONE*nProtect %N +a" EXECUTE
@ENDNODE

@NODE node_hist "DirII - History"
 @{b}Pre-release@{ub}

   1.n
      Simple DIR replacement which displayed in neat columns.

   2.n
      Added DOS 2.0 pattern matching and ReadArgs.


 @{b}Post-release@{ub}

   3.0
      Added lots!
      Is now a replacement for DIR and LIST.

   3.1
      Added COMMENTPAT and NOINFO.

      Can now supply a number to SINCE/UPTO.
      eg. "SINCE 1" = "SINCE yesterday"

      Added a work-around for the problem I had getting StrToDate
      to parse weekdays.

      Extra Ctrl-C checks for the impatient.

      Hopefully removed the occasional "object not found" message
      which could occur if no DIR argument was supplied.

      Fixed incorrect path (%p,%j) when the DIR argument supplied
      was a file (ie. was not a dir or wildcard pattern).

   3.2
      Fixed bug for "SINCE n" and "SINCE weekday"

      Fixed bug which caused all directories to be scanned when ALL
      specified, even if they didn't match the DIR argument.

      The output is displayed in columns even if one or more of SIZES,
      TYPES, etc. are specified.

      Added more types (LZX, Loadable, Font), and DirII now displays the
      first few characters of a file if its type was not recognised.

      Changed behaviour of DirII when empty strings supplied for command
      line options.

      Minor changes to the display of summaries (number of files, etc.)
      and the paths.

      Added %w LFORMAT switch.

      Filenames containing spaces are now enclosed in quotes.
      (Not when using LFORMAT)

   3.3
      Fixed %w bug that occurred when a single character was matched by a
      wildcard, and also v3.2 did not know that ~c means the same as ~(c)

      Added support for multi-directory assigns.

      Stopped extra CR's being printed for empty dirs when SIZES specified

      Internal changes to production of LFORMAT listings.

   3.3a
      Fixed bug (in 3.3 only) that caused paths to not be displayed when ALL
      specified but no path present in the DIR option.

@ENDNODE

@NODE node_cre "DirII - Credits"
 @{b}Amiga set-up@{ub}

   A1200 with 170Mb HD, 2+4Mb RAM and 1942 monitor.


 @{b}Author@{ub}

   Stephen Davies
   98 Larches Lane
   Ashton
   Preston
   Lancs
   England
   PR2 1PP

   2:2500/73.18@fidonet
   2:256/503.13@fidonet


 @{b}Thanks to@{ub}

   Mike Dodd and Steve Bleasdale for spreading DirII propaganda.

@ENDNODE
