Homepage EPM Guestbook SiteMap

Jörg's Change Directory - by Jörg Tiemann

Summary:  Jörg's Change Directory is a little REXX solution make the changing of directories more comfortable.  Beside other features a search through the database of Wolfgang Sarp's "Wolfgang's Change Directory" (no homepage found, download link at the end of this document) is implemented. This database is also used by the more prominent OS/2 Commander, an excellent Norton Commander clone.


For impatient users  

Download Jörg's Change Directory (.ZIP, 17kB), unpack the zip, place jcd.cmd somewhere in your path. Modify the lines 9-11 of jcd.cmd and be happy.

Where do I want to cd to today?  

Every now and then, while wandering through my favorite command line interface (CLI) the sudden urge to change to another directory gets hold of my mind. From that point on I'm restless and forlorn in my blind struggle for directory change. Happy is me, that I have found a means to easily master the situation, to cope with the myriads of directories on my hard disks, to quickly and precisely spot the looked for one and cd to it.

My method to achieve all this is neither new nor revolutionary. I use a database of the existing directories and a program, a little REXX script to be exactely, to find among all the directories (have I spoken of "myriads" of them above? yes, I have!) either the one I am looking for or to present me a list of the most promising candidates.

Even more that this. My script uses 2 databases and also examines the current directory if there's a subdirectory suitable to match the information I have given as my cd'ing destination wish. Moreover relative cd'ings and those to the previous directory are supported.

JCD in not so detailed view  

When you open the package you find just two files, jcd.cmd and jcd_readme.html.  jcd_readme.html is what you are reading, jcd.cmd is the REXX script.  That's it.

With only this two files what can jcd do for you? Well, it's better than nothing, surely better than cmd.exe's build in cd command, but it could be more:

  • cd to a given subdirectory
  • cd to a directory on another drive
  • cd to the last directory jcd'd away from
One more - to me precious - advantage over cmd.exe's cd is that jcd has no problems handling trailing backslashes as they might be provided by a file and directory name completion, for example by my soon to be published file name completion for the EPM shell.<g>

But is there no more to this?  

Yes there is. Load jcd.cmd into your EPM and have a look at the lines 9 to 11:

WCDatenbank  = 'r:\wcd.db'
SCDatenbank  = 'r:\jjliste.db'
Templist     = 'r:\jcdliste.tmp'

"Datenbank" is German for database. So here we have our two databases. SCDatenbank points to the database used by "Jörg's Jump2Directory" (by the same author).  I strongly suggest you have a look at it, it inhabits the webpage next to this. There you learn all about the structure of this database and what it is good for.

Note: Though the Jump2Directory functionality of jj.cmd is implemented in jcd.cmd, it is not quite the same. Whereas in jcd.cmd the jj nick name resolution is just an additional feature and thus an additional check performed against the given parameter, it is the sole purpose of jj.cmd to find a matching nick. Therefore jcd.cmd looks for exact matches, while jj.cmd looks for all occurences of the nick in the given parameter.

The second database jcd uses is that of Wolfgang Sarp's "Wolfgang's Change Directory", respectively his famous "OS/2 Commander". Both programs are shareware and at least one of it is needed if you want to use all the power if jcd.  In the future I may add a REXX script which can create a compatible database, but at the moment I'm not that far and jcd can only read wcd.db.

It does not matter if you use jcd without the one or the other database. It just restricts the use of this script to the more basic change operations.

Now the last entry to customize is "Templist". Here you have to enter a path and filename where jcd can store a temporary list of directories it creates when finding more than one possible destination directory at a run.

All to complicated?  

OK, let's have a look at the long help screen, for it - in examples - tells a lot about jcd:

epm: E:\tmp > jcd -lh
 Joerg's Change Directory v0.64 - Mon, 8 Oct 2001
 (c) 1997-2001 by Joerg Tiemann

 Usage: jcd [options] [argument]

 Available options are:

   -? -h     show help
   -lh       show long help (this one)

   -         switch to previous directory
   \         change to root of current drive
   . .. ...  go [number of points] directory level(s) up

   -l        show list of available directory shortcuts

   +p [arg]  push dir (put current directory in 1st position of jcd
             directory stack and optionally change to [arg])
   -p        pop dir (return to 1st position of directory stack)

 The argument, if given, can be one of these:
   1. a directory name with an absolute path
   2. a directory name with a relative path
   3. a directory name
   4. a shortcut for a directory
   5. a part of a directory name as a search string
 1 to 3 may have trailing backslashes.
 4 requires the Joerg's Jump2Directory database.
 5 requires the Wolfgang's Change Directory database.

 Examples:

   j:\help> jcd desk
     changes directory to j:\help\desk or, if that doesn't exist,
     jcd looks for a shortcut named desk and, if that does not exist,
     it searches the wcd database for directories matching "desk".
     Finally jcd either presents a list of found directories - or
     if there's only one - changes to it.
     Sounds a lot more complicated that it is! <bg>

   o:\os2> jcd e:\ibmworks\data\mystuff\
     switches to directory e:\ibmworks\data\mystuff

   e:\misc\pg\texts\etext96> jcd ..\..\catalog\archive
     switches to e:\misc\pg\catalog\archive

   r:\long\and\complicated\directory\structure> jcd \
     brings you back to the root r:\

   g:\Sol\Mercury\Venus\Earth\Mars\Jupiter\Saturn\Uranus\Neptune\Pluto> jcd .....
     '5 warps to Mars!' warps you up to g:\Sol\Mercury\Venus\Earth\Mars

   t:\ie> jcd -
     brings you back to the directory you last switched away from with jcd

   m:\ann> jcd +p t:\hanks\you
     stores m:\ann in position 1 of directory stack and changes to t:\hanks\you
     this feature is not yet implemented!

   f:\or\using\jcd> jcd -p
     returns to the directory last stored in the directory stack
     this feature is not yet implemented!

epm: E:\tmp > 

The non avoidable disclaimer  

I have written Jörg's Change Directory and you are hereby entitled to use this software for free. 

But if you use Jörg's Change Directory you do it at your own risk!

I am not aware of any bugs the script may have and in 4 years it has never caused any data loss or damage on my system.

But if you use Jörg's Change Directory you do it at your own risk!

Thus if you like the script and you feel good about it, fine!  But if Jörg's Change Directory by some strange accident (strange at least to me) manages to wipe all your data, poisons your favorite wife and en passant kills the mentally saner half of the inhabitants of Walla Walla (Washington, USA) I am neither to blame nor to thank for.  I'm just a guy who merely sings to what appears to be a cat and punches little caps on what appears to be a keyboard.  Should I be or do wrong - sorry!  That's all you can expect from me.  If you want someone to be right, be (or do) Mr. (or Mme.) Right yourself!  And I mean this in the nicest possible way.

If you want to share your thoughts on this script with me, you'll find my email address and my PGP pubkey on my feedback page.

Addendum: why the n+1st cd'ing util?  

There are reasons for this too, and reasons for the reasons, there always are.
   -- Raymond Chandler, _The Simple Art of Murder_

Well, the answer is not hard to find.  Toying around with the EPM command shell I found out that at the time none of the available cd tools was suitable to my needs.  Many of them were very slow, other had huge, nearly impossible to maintain directory databases and the one tool that was fast and had a slim directory database, Wolfgang's Change Directory, insisted to use ANSI sequences to write on the screen.  Those do not work in the EPM command shell.  Thus I had a real close look at the database format, which is a very clever one, and did my best to use this (as a registered user of OS/2 Commander I in any case create my directories with it and thus had the database).  I made some enhancements, allowing jcd to also use the little shortcut database of my "Jörg's Jump2Directory", accepting trailing backslashes and was happy.

Moreover I think, though being by no means a programmer, I aquired a considerable amount of knowledge about how to solve problems using REXX (though using the same structures again and again - I'm kind of a 3.14159... (.TXT, 1.4 MB) trick pony ;-)).

If you want to have a look at the competitor you can download Wolfgang's Change Directory from Hobbes: wcd161.zip (81kB)


Homepage Top EPM Guestbook SiteMap

Copyright © 2001 - Jörg Tiemann Last modified: Wed, 24 Oct 2001

gratis SMS verschicken im Uboot.com gratis HTML checken bei w3.org gratis quer denken mit Wau Holland