[net.micro.amiga] Specifying Currentdir

toebes@sas (01/28/86)

I had previously posted a question (among several to Commodore) concerning
specifying the current directory.  It just dawned on me that because of
the way the file system appeared to be implemented that you can specify
the current directory very simply as a null string.  For example, a very
useless command to illustrate this is:
    CD ""
Which changes directory to the current directory.  If you want to save the
current directory, change to another, and then return to the original one
(As I have wanted to do in several batch files) you can use this trick
with the assign command:
     Assign savedir: ""
      .... Do any commands including CD
     CD savedir:
The end result is that yor are where you started from.

Another great use for this is in the copy command:
     copy df0:c/#? ""  ; copies everything from the C directory to here
     copy "" ram:      ; copies everything in the current directory to ram:
Unfortunately the one use I wanted it for fails which is
     copy c:run ""
To copy a single file to the current directory without me having to figure
out where I am first.  It complains about not finding /run which doesn't
make much sense.  If you want it to work, just use a pattern like:
     copy c:ru? ""
and it doesn't complain.

Using it with the remaining AmigaDOS commands doesn't seem to gain much,
but if anyone finds more uses for it, please share it.

Technical: The purpose of the "" is to pass a null string as the file name.
I believe that the filing system looks at the string, sees no : or / and 
decides the file is a relative path name.  Having decided that, it starts
with the current directory and applies the path name parts, of which there
are none, until it exhausts the string, ending with a relative path name
pointing to the current directory.  Technically, this is a bug, but I for
one would hate to see it get fixed unless we get a way to really specify
the current directory.

John A. Toebes, VIII      !mcnc!ncsu!sas!toebes (on clear sunny days)
120-H Northington Place   Cary NC 27511