home *** CD-ROM | disk | FTP | other *** search
/ Media Depot 5 / mediadepotvolume51993.iso / FILES / 41 / LFNSRT12.ZIP / LFNSORT.TXT < prev   
Encoding:
Text File  |  1996-07-07  |  19.0 KB  |  437 lines

  1. LFNSORT v 1.2 - Sorts DOS/Win95 directories
  2.  
  3. Copyright (c) 1995,1996 D.J. Murdoch.
  4.  
  5. 0. Contents of this file
  6.  
  7.    1. Syntax
  8.    2. Description
  9.    3. Details
  10.    4. Memory Limitations
  11.    5. Safety
  12.    6. License
  13.    7. Release History
  14.    8. Known bugs
  15.    9. Acknowledgments
  16.  
  17. 1. Syntax:
  18.  
  19.       LFNSORT sortkeys [dirname] [options]
  20.  
  21.         will sort the directory records on disk according to the
  22.         specified sort keys.
  23.  
  24.       Keys:
  25.         N - full filename
  26.         E - extension
  27.         D - last modification date
  28.         T - last modification time
  29.         C - creation date/time
  30.         A - last access date/time
  31.         S - size
  32.  
  33.         Place a "-" minus sign in front of a key to sort in descending
  34.         order instead of ascending order.  Keys can be combined, e.g.
  35.         "-DN" for "sorted by descending modification date, and by
  36.         ascending name within date".  Use "-" by itself as a placeholder
  37.         if you want no sort key.
  38.  
  39.       Options:
  40.         /8       base sort order on 8.3 version of names instead of long
  41.                  names
  42.         /C       case sensitive sort - ascii sort order
  43.         /D       mix directories in with files
  44.         /Debug file  write debug information to file
  45.         /F filename  read forced sort order from file (see below for
  46.                  syntax and examples
  47.         /NW      no write - changes won't be saved to disk
  48.         /S       sort subdirectories recursively
  49.         /System  don't sort system files first in the root dir
  50.         /V       verbose mode; list all directories and filenames after
  51.                  sorting
  52.  
  53.       Examples:
  54.  
  55.         To sort every subdirectory on drive C: by file extension then
  56.         filename:
  57.  
  58.           LFNSORT en c:\ /s
  59.  
  60.         To sort every directory on drive C: so that most recently
  61.         accessed files come first:
  62.  
  63.           LFNSORT -a-d-t c:\ /s
  64.  
  65.         (The "-d-t" is necessary because not all directory records
  66.         include an access time; older ones and ones created in DOS mode
  67.         will only have a modification time.)
  68.  
  69. 2. Description:
  70.  
  71.         The original Norton Utilities had a program called DS which
  72.         could sort your DOS directories according to your preferences.
  73.         Later versions added a graphical interface so you could manually
  74.         move files around.
  75.  
  76.         When Win95 came out with the VFAT long filenames, DS stopped
  77.         working.  It hadn't been written to handle the new directory
  78.         records.  Symantec (the current owners of the Norton Utilities)
  79.         haven't produced a new version of DS as far as I know, so when
  80.         Jacques Bensimon suggested that a minor modification to my
  81.         long filename backup utility DOSLFNBK could do directory sorts,
  82.         I decided that I wanted DS badly enough to write it myself.
  83.         There is already at least one freeware/shareware utility called
  84.         DIRSORT, so I called mine LFNSORT.
  85.  
  86. 3. Details:
  87.  
  88.       Disk locking:
  89.  
  90.         LFNSORT works on the disk drive at a pretty low level.  To be
  91.         allowed this access, it requests exclusive access to the drive
  92.         from Windows.  If another program has already requested
  93.         exclusive access, LFNSORT will exit and do nothing.  While
  94.         LFNSORT is running, other programs will not be allowed to write
  95.         to the disk or to create new files.  This may confuse them; it's
  96.         probably best not to attempt any other disk activity in the
  97.         middle of an LFNSORT run.  (LFNSORT has been written according to
  98.         Microsoft's instructions to work without damaging your disk even
  99.         if another program attempts access, but the other program might
  100.         not be.)
  101.  
  102.         LFNSORT handles the disk locking itself.  In fact, if you use
  103.         the LOCK command to lock the drive, LFNSORT will be unable to
  104.         obtain a lock, and will not run.
  105.  
  106.         If you run LFNSORT under DOS, or in a version of Windows that
  107.         doesn't support drive locking, it will still run.  If it detects
  108.         Windows it will warn you that running in a multitasker without
  109.         protecting the disk from changes is dangerous, and will only
  110.         go ahead if you confirm you really mean it.  If it doesn't detect
  111.         Windows, it will assume that it is safe to go ahead --- so if
  112.         you're using another multitasker like Desqview, use it with
  113.         extreme care!
  114.  
  115.       Forcing a particular order:
  116.  
  117.         The /F option takes a plain ascii file as an argument.  This
  118.         file should have the following format:
  119.  
  120.            \directory1
  121.            firstfile
  122.            secondfile
  123.            thirdfile
  124.  
  125.            \directory2
  126.            afile
  127.            bfile
  128.            cfile
  129.  
  130.         Specifically:  any line with a backslash "\" in it is taken as a
  131.         directory name, any other non-blank line is taken as a filename.
  132.  
  133.         These will force the files in directory1 and directory2 into the
  134.         order given.  If a file isn't listed, it will normally appear
  135.         *after* all the listed files.  However, you can override this by
  136.         putting a "*" entry in place of a file; then all unlisted files
  137.         will be placed there.  For example,
  138.  
  139.           \directory
  140.           firstfile
  141.           *
  142.           lastfile
  143.  
  144.         will guarantee the placement of those two files, but sort
  145.         everything else according to the specified sort keys.  (Hint:
  146.         if you want to use the file to specify part of the order but
  147.         make no other changes, use "-" as a sort key.)
  148.  
  149.         The order in which the directory sections appear in this file is
  150.         ignored. If you want directories in a particular order, list
  151.         them in a section for their parent directory. If you don't
  152.         specify any directory name, the ordering is used as a default
  153.         for unlisted directories. For example, to put README.1ST
  154.         files first in every directory where they exist, put a single
  155.         line containing "README.1ST" into a file called FORCED.LST, and
  156.         run
  157.  
  158.           LFNSORT - c:\ /f forced.lst
  159.  
  160.         File and directory names in this file may normally be either 8.3
  161.         aliases or long filenames, but if you're running outside Windows
  162.         where there is no long filename support, you *must* use the 8.3
  163.         alias.
  164.  
  165.         If you want to force the file order for a large collection of
  166.         directories, you can use the /V option to create a preliminary
  167.         version of the forcing file.  For example,
  168.  
  169.           LFNSORT - c:\ /D/System/NW/S/V >new.lst
  170.  
  171.         will write a list of the files in their current order
  172.         into the "new.lst" file.  The - specifies no sorting, and the
  173.         /D and /System options turn off the default actions for
  174.         directories and system files.
  175.  
  176.       Moving system files:
  177.  
  178.         Normally the root directory of your boot drive has IO.SYS first,
  179.         and MSDOS.SYS in the second place.  As long as these are left
  180.         with the System and Hidden attributes set, LFNSORT won't move
  181.         them.  However, if you accidentally move them and want to
  182.         restore them to the start of the directory (because some
  183.         versions of DOS won't boot if they get moved):
  184.  
  185.         Put these two lines in a file called FORCED.LST:
  186.  
  187.           IO.SYS
  188.           MSDOS.SYS
  189.  
  190.         and run
  191.  
  192.           LFNSORT - c:\ /F forced.lst /System /D
  193.  
  194.       Volume labels:
  195.  
  196.         Pre-7.0 versions of DOS can be confused by long filename
  197.         records, which look to them like volume labels.  This can be
  198.         fixed by putting the volume label before any long filenames in
  199.         the directory, but the Win95 LABEL command doesn't do this.
  200.         LFNSORT fixes this, unless you use the /System option, in which
  201.         case the volume label will be sorted like a file record.  Don't
  202.         put the volume label ahead of your boot files, if you want your
  203.         disk to be bootable.
  204.  
  205.         Example:  If you want to put the volume label "BIG DRIVE" just
  206.         after IO.SYS and MSDOS.SYS, set FORCED.LST to
  207.  
  208.           IO.SYS
  209.           MSDOS.SYS
  210.           BIG DRIVE
  211.  
  212.         and run
  213.  
  214.           LFNSORT - c:\ /F forced.lst /System /D
  215.  
  216.  
  217.       Exact sort rules:
  218.  
  219.         What LFNSORT does when sorting a directory is to compare all
  220.         files, applying the following rules in order until it can tell
  221.         which of a pair of files should come first:
  222.  
  223.           1.  "." and ".." are always left in place.
  224.           2.  Unless you override it with the /System option, files
  225.               in the root directory with the System attribute will be
  226.               moved ahead of other files but will otherwise not be sorted.
  227.               The volume label entry will be moved just after them.
  228.           3.  If you haven't used the /D option, then subdirectories
  229.               are placed before files.
  230.           4.  If you have used a /F file to force a sort order, and the
  231.               current directory is listed there, then it is used to
  232.               specify the order.  If the current directory isn't listed
  233.               there but files are listed with no directory name, then
  234.               that order is used.  Any file which isn't listed is put in
  235.               the place of "*" in the list, which defaults to last.
  236.           5.  The comparison rules given by the sort key are applied
  237.               in order from left to right.
  238.           6.  If after all those comparisons LFNSORT can't tell which of
  239.               two files should come first, then they're left in the
  240.               original order (i.e. LFNSORT performs a "stable" sort.)
  241.  
  242.       Running in DOS or DOS mode:
  243.  
  244.         LFNSORT should be able to run in pre-Win95 versions of DOS, or
  245.         in the DOS mode of Win95 (the one you get if you "Restart
  246.         computer in MS-DOS mode" or choose console mode from the initial
  247.         boot menu).  The main limitation is that long filenames aren't
  248.         supported on the command line or in the forced order file.
  249.         However, the (invisible) long filename records will still be
  250.         sorted, and the /V option can be used to print the long names of
  251.         files.  Directory names will be printed in the 8.3 form.
  252.  
  253.       Erased file records:
  254.  
  255.         LFNSORT deletes any erased file records that are left in the
  256.         directory.  This helps to speed up disk access, but it means
  257.         that some file undeletion programs (the ones that don't keep
  258.         their own records of deleted files) won't be able to undelete
  259.         files after a LFNSORT run.  LFNSORT doesn't shrink the disk
  260.         space used by a directory; use a defragger or other tool to do
  261.         that.
  262.  
  263. 4. Memory Limitations:
  264.  
  265.         Once it has exclusive access to the disk, LFNSORT reads entire
  266.         subdirectories into memory all at once.  Because this version is
  267.         a DOS real mode program, that limits the size of directory that
  268.         it can sort.  It needs enough space to store two copies of the
  269.         whole directory record in memory, which means it will refuse to
  270.         sort directories with more than about 6000 short filenames.
  271.         Long filenames take up more space, and the limit will be lower.
  272.  
  273.         If you have a directory that is too large to sort, LFNSORT will
  274.         just leave it as is on the disk.  Your only choice then is to
  275.         manually move enough files out of the directory so that LFNSORT
  276.         can run, and then move the files back afterwards.
  277.  
  278. 5. Safety:
  279.  
  280.         LFNSORT works with your disk at a level below the file system,
  281.         so if things go wrong while rewriting a directory, it's
  282.         conceivable that you could lose whole files or directories.
  283.         I've tried to make it as safe as I can, but you should follow
  284.         some simple precautions:
  285.  
  286.           - If you aren't sure of the integrity of your file system, run
  287.           Scandisk before LFNSORT and get it to fix any errors.  In
  288.           particular, if you've run other low level software (e.g. a
  289.           defragger or DOS-based directory sorter) that may have messed
  290.           up the LFNs, run Scandisk first.
  291.  
  292.           - Don't turn off or reboot your PC in the middle of an LFNSORT
  293.           run.  If there's a power failure or (horrors!) a bug in
  294.           LFNSORT forces you to reboot, then Scandisk should be able to
  295.           repair most of the damage, but you may have to manually rename
  296.           some files.
  297.  
  298.           - If you hit Ctrl-Break or Ctrl-C during an LFNSORT run,
  299.           it shouldn't do any damage other than giving you only a
  300.           partial sort.
  301.  
  302.           - LFNSORT was written for version 4.00.950 of Windows 95 (the
  303.           August 1995 release).  It hasn't been tested on the earlier
  304.           beta test versions or on any later release than the 4.00.950a
  305.           maintenance fix pack.  If the VFAT file structure isn't what
  306.           LFNSORT is written for, it could do some real damage.
  307.  
  308.           In particular, LFNSORT will definitely not work on FAT32, and
  309.           if everything works, it will refuse to run there --- but this
  310.           has never been tested since at the time of this writing FAT32
  311.           is still in beta testing.
  312.  
  313.           - There may be special conditions on your system that LFNSORT
  314.           won't be able to handle.  If you can, try it out first when
  315.           you've got a good backup to make sure it works.  If it
  316.           doesn't, *please* send me details, and I'll attempt to fix it.
  317.  
  318. 6. License:
  319.  
  320.         LFNSORT is shareware, *not* public domain software. You may use
  321.         it at no charge for an evaluation period of 30 days only.
  322.         You are free to distribute unmodified copies of the complete
  323.         LFNSORT package, provided your total charge is no more than $1.
  324.         The total cost of a compilation (e.g. a CD ROM) including
  325.         LFNSORT must be no more than $1 per package in the compilation.
  326.  
  327.         To continue to use LFNSORT beyond the 30 day evaluation period,
  328.         you must register it.  There are three possible registration
  329.         levels available:
  330.  
  331.           $10 simple registration + $5 handling charge
  332.  
  333.         This registration fee gives you a license to use one copy of
  334.         LFNSORT indefinitely.  If you include an email address I will
  335.         notify you of new versions and how to obtain them yourself. I'll
  336.         also attempt to answer emailed questions about LFNSORT from
  337.         registered users. Payment may be made in Canadian or US dollars
  338.         (at par), or the UKP equivalent of $15 US.  NOTE:  See below for
  339.         how to avoid the handling charge.
  340.  
  341.           $20 upgrade registration + $5 handling charge
  342.  
  343.         This registration fee also entitles you to use LFNSORT
  344.         indefinitely.  In addition to the license to use it, I will mail
  345.         you a diskette containing the latest version, together with a
  346.         collection of other freeware and (unregistered) shareware
  347.         programs that I have written (including DOSLFNBK).  If you send
  348.         an email address I will notify you of updates, and send one free
  349.         update by email if you request it.  Payment may be made in
  350.         Canadian or US dollars (at par), or the UKP equivalent of $25
  351.         US.
  352.  
  353.           $45 source code registration + $5 handling charge
  354.  
  355.         LFNSORT was written in Borland Pascal 7.01, using the excellent
  356.         Object Professional library from TurboPower Software.  In
  357.         addition to the benefits of the upgrade registration, the source
  358.         code registration gives you the LFNSORT source code (including
  359.         an object-oriented low-level disk access unit, access to the new
  360.         Win95 DOS API functions, and a huge memory support unit, but not
  361.         OPro).  Payment may be made in Canadian or US dollars (at par),
  362.         or the UKP equivalent of $50 US.
  363.  
  364.         Any of the registrations can be done by sending a cheque or
  365.         money order to:
  366.  
  367.          Duncan Murdoch
  368.          337 Willingdon Ave.
  369.          Kingston, Ontario, Canada.
  370.          K7L 4J3
  371.  
  372.         NOTE 1:  If you send a $10 simple registration order directly to
  373.         me at this address, I will waive the handling fee.  Send a
  374.         cheque or money order for $10 in Canadian or US dollars, or the
  375.         UKP equivalent of $10 US.
  376.  
  377.         NOTE 2:  I will be going overseas from August 1996 to June 1997.
  378.         During this time I will still fill orders, but there are almost
  379.         certain to be delays.
  380.  
  381.         You can also register or order source code from the Public
  382.         (software) Library (PsL) using MC, Visa, AmEx, or Discover card:
  383.         - by calling 800-242-4775 (US only) - by calling 713-524-6394 -
  384.         by faxing your order to 713-524-6398 - by sending your order by
  385.         Compuserve to 71355,470 - by sending your order by Internet to
  386.         71355.470@compuserve.com PsL only accepts payment in US dollars.
  387.         Please give PsL your name exactly as it appears on the card, and
  388.         tell them your card's expiry date. LFNSORT is PsL product
  389.         #14528.
  390.  
  391.         The PsL numbers are for ordering only.  I *cannot* be reached at
  392.         the PsL numbers.  To contact me for information about dealer
  393.         pricing, volume discounts, site licensing, the status of
  394.         shipment of the product, the latest version number or for
  395.         technical information, write to me at the address above or the
  396.         email address below.  I'd especially like to hear bug reports
  397.         and suggestions for improvements.
  398.  
  399.          Internet:   dmurdoch@mast.queensu.ca
  400.  
  401. 7. Release history:
  402.  
  403.         0.0 - first alpha test version
  404.         0.1 - second test version.  Bugs fixed; parameter parsing logic
  405.               rationalized; /NW and /V options added; DOS support added
  406.         0.2 - fixed bug with writing to a directory being sorted,
  407.               formatting /V
  408.         0.3 - worked around Stacker incompatibility
  409.         1.0 - first public release, same as 0.3 except for removal of
  410.               debugging code
  411.         1.1 - added special handling of volume labels
  412.         1.2 - dropped use of obsolete DOS service 1Ch,
  413.               minor cosmetic changes, improved memory management,
  414.               allowed use of SUBST, added check for existence of initial
  415.               directory, stopped treating System directories as special,
  416.               fixed display of volume label
  417.  
  418. 8. Known bugs
  419.  
  420.         When run in Win95 in a DOS window, the window sometimes switches
  421.         to full screen when LFNSORT locks a disk drive.  On some
  422.         systems, this results in junk on the screen.
  423.  
  424.         Very large directories won't be sorted.
  425.  
  426.         International character sets aren't sorted properly.
  427.  
  428. 9. Acknowledgments
  429.  
  430.         LFNSORT wouldn't have been written without the enthusiastic
  431.         encouragement of Jacques Bensimon.  It relies heavily on the
  432.         source code to DOSLFNBK, which was written based on the
  433.         information in Robert Hummel's article on Win95 long filenames
  434.         in the June/July 1995 issue of PC Techniques Magazine.  Thanks
  435.         are also due to the DOSLFNBK and LFNSORT beta testers, several
  436.         of whom were put to considerable inconvenience.
  437.