			  MT - Move To drive/directory

			  Copyright Jason Hood 1996-7

				    Freeware


				  Description

 mt is a complete CD replacement.  It allows for the use of slash ("/") as well
 as backslash ("\") in directory  names.  The dot notation has been extended so
 "grandparent"  and  "great-grandparent",  etc.,  can  be  specified.   Partial
 directory  names are supported.  The two previous  directories are remembered.
 And of course, the drive can be changed along with the directory.


				  Requirements

	DOS 3.0+
	286+ (but could be recompiled for less)


				  Installation

 Place mt.com in your path.  It doesn't really matter where the other files go.
 Add this to your autoexec.bat:

	[path]mtmem.com [d:/path] [;prev] [;;bprev]

 where: path is the path to mtmem.com;
	d:/path is the drive and path to place the directory structure file;
	;prev & ;;bprev are the initial previous directories.

 If  d:/path  is not specified,  it will default to the same path as mtmem.com.
 If the previous  directories  are not	specified  they will be set to nothing.
 Memory will be allocated high (if available),	using best fit.  (The memory is
 used to store the path and previous directories, as well as providing instance
 data for task switchers.)

 The next step is to setup the directory structure file for the partial names:

	mt @drives

 where	drives	is the list  of drives	you wish  to scan.  The drives	will be
 scanned  in the  order  specified  and invalid  drives will  be ignored.  I've
 allowed for  1200 directories per drive.  If you have more than this,	it will
 probably crash, 'coz I've not tested for it.


				     Usage

 "mt ?"  or  "mt <any-character-of-your-choice>?"  will  display a  help screen
 (at least, I hope it helps).

 "mt @cd",  for example,  will scan drives  C: and D:.  "mt @"  will update the
 file for drives  previously scanned  (by totally rescanning the drives).   The
 file's path can be changed via mtmem.com.

 "mt ..."  is equivalent to  "mt ..\.."  - ie.  it will move you to the "grand-
 parent" directory.  Any number of dots can be specified, but of course it will
 fail if you try to move too far back.	Note that the extra dots will only work
 at the start of the path  -  if specified in the  middle you will get an error
 (but it's a silly thing to do anyway).

 "mt;" will move you to the directory you just moved from  (so repeatedly doing
 "mt;" will toggle between two directories).  "mt;;"  will move you to the dir-
 ectory before the previous directory.	These directories can be explicitly set
 by using mtmem.com.

 "mt d:path" is the same as CD,  but it will change drive as well,  slashes (/)
 can be used, and the trailing (back)slash (if any) will be removed. It is also
 possible to use a star ("*") for the last directory name.  The first name that
 matches (in the file table, not alphabetically)  will be selected.   So if you
 have a games directory has dos and windows as subdirectories, and dos is first
 in the file table,  then "mt d:/games/*"  will get you there.  Similarly,  "mt
 d:/games/w*" will move you to the windows subdirectory.

 "mt name1 name2 ..."  (that's an ellipsis,  not grandparent) is roughly equiv-
 alent to  "mt name1*/name2*/..."  - ie.  it looks for a  directory that starts
 with name1, has a subdirectory that starts with name2, etc.  Note that if only
 one name is specified it looks for a subdirectory before it starts the search.

 Searches always begin from the root,  in drive order  (when the structure file
 was created).	To search a particular drive: "mt d:name1 name2 ..." where d is
 the drive you want.   The first match found will be the one selected.	If it's
 not the one you want,	you will need to narrow the search  (by specifying more
 characters).	(I find it easier to type  than to select from	a damn annoying
 pop-up window.)   Directories are stored alphabetically, with precedence given
 to paths closer to the root.	So given directories /games and /windows/games,
 "mt g"  will find /games,  since it closer to the root.   But with directories
 /windows and /windoze,  "mt w" will find /windows, since "w" comes before "z".
 If you are already in the directory that matched first,  it will try and find
 another match. So with the two "w" directories above, "mt w" will move you to
 "/windows" and "mt w" from within that directory will move you to "/windoze".

 It's also possible  to specify a complete path  after the partial paths,  for
 those directories that have not yet been scanned.  "mt w /newdir" will search
 for a directory starting with "w"  (eg. "/windows") and then add "/newdir" to
 it, resulting in "/windows/newdir".

 "mt +[+][path]"  will add path (and its subdirectories) to the structure file.
 If  it  doesn't  exist  it  will  be created. If it is absent then the current
 directory will be added if path is absent.  Unlike the MD  command  more  than
 one directory can be created:

		mt +path1/path2        =	md path1
						md path1\path2

 If,  when creating directories,  a path already exists  (eg. "/games"  exists,
 when doing "mt +/games/newgame"), then it is assumed that "/games" has already
 been scanned,	so only the "newgame" part will be added.  The second plus will
 also move you to the directory.

 If the drive  isn't in the  file then it  will be added with only the selected
 directories. If the root is added (ie. "mt +c:/") then the whole drive will be
 (re)scanned.

 "mt -path"  will remove path (and its subdirectories) from the file and delete
 it from disk (EVERYTHING is deleted). "mt --path" will only remove it from the
 file.	Removing a root directory (ie.	"mt -c:/") will remove the entire drive
 from the file,  but it will  never be deleted	from disk.  path must  exist in
 order for it  to be deleted  (ie.  RD'ing or DELTREE'ing  will mean rescanning
 the entire drive,  or recreating the directories and removing again.)	 If the
 drive is not  in the file,  the path will still be deleted.   Note that unlike
 DELTREE,  this will not delete individual files.  As a precaution, "mt -" will
 not delete the current directory, use "mt -." instead.

 WARNING: THERE IS NO CONFIRMATION! It will be deleted IMMEDIATELY.

 One last option is  "mt #ext ...".  This replaces the normal "mtdirs.dat" file
 with  "mtdirs.ext"  (for this line only).  It is intended for removable media,
 particularly  shareware/magazine CD-ROMS.  So	"mt #pcw @e"  will scan E:  (my
 CD) and create "mtdirs.pcw" (in the same path as "mtdirs.dat").  Then "mt #pcw
 mods" will find a directory starting  with "mods" on that CD.  Two hashes will
 make the extension permament  (place it  in the resident memory).  If "ext" is
 omitted, it will default to "dat".

 Finally,  it is possible to do multiple options on one line.  However, as soon
 as a move is encountered, processing will stop:

	mt +abc +def ++ghi		will create three directories and move
					to "ghi".

	mt ++ghi +abc +def		will create and move to "ghi", but skip
					the other two.


				  Return Code

 0 - Successful operation (including help & status)
 1 - MTMem not loaded
 2 - Unable to create/load the structure file
 3 - Directory not found
 4 - Cannot create directory
 5 - Cannot delete directory


			       Known Limitations

 As mentioned above,  too many	directories on a  drive will  probably	cause a
 crash	(but 1200 directories!).  This can be fixed by changing MaxDirs to 2000
 and recompiling in the small model.
 Removing all drives WILL result in a crash - just don't do it.
 There is no "optimizing"  -  to remove paths that have been deleted from disk,
 but still exist in the file, a complete rescan is necessary. Removing the last
 directory of a drive will not result in that drive being removed.
 There is no provision for renaming directories: either treat it as a good time
 for a rescan, or use a batch file/doskey macro:

 rendir.bat:	@echo off	doskey rendir=mt --$1$Tmove $1 $2$Tmt +$2
		mt --%1 	(or you might like:
		move %1 %2	doskey rendir=echo off$T<the above>$Techo on)
		mt +%2


				 Redistribution

 If you're just giving it to your mate,  only the two .com files are necessary.
 However,  if you plan to upload it to a BBS or FTP site (or whatever), I'd ask
 that you upload the original zip-file	(or whatever archiver  you prefer).  If
 you modify the source, let me know and I'll redistribute an "official" version
 (after all,  I still hold copyright),	but I have no objections if you distri-
 bute both my original code and your modification (but please, do let me know).


				    Address

 e-mail:	hoodj@topaz.cqu.edu.au

 snail mail:	Jason Hood
		11 Buckle Street
		North Rockhampton
		Queensland, 4701
		Australia.


				    Finally

 This program is copyrighted Freeware.	 Feel free to give it to all and sundry
 (under the conditions mentioned in "Redistribution").   But if you sell it,  I
 curse you to everlasting bankruptcy.


				   Disclaimer

 Since I'm deleting directories, I'd better add this:

	I will not be held responsible for accidental deletion. I've warned
	you that deletion will occur immediately and that all files will be
	deleted.


 Jason Hood, 11 February, 1997.
