Dec 252017
Rename directories.
File RENDIR.ZIP from The Programmer’s Corner in
Category File Managers
Rename directories.
File Name File Size Zip Size Zip Type
RENDIR.BAS 5381 1982 deflated
RENDIR.COM 1152 798 deflated
RENDIR3.DOC 3840 1578 deflated

Download File RENDIR.ZIP Here

Contents of the RENDIR3.DOC file

RENDIR Unto \Caesar
(PC Magazine Vol 5 No 7 April 15, 1986 by J. Dickinson)

One of DOS's minor annoyances is that the system isn't designed
to allow you to rename subdirectories. With DOS 3.0, function 56h
became able to rename a subdirectory. (Actually, in DOS 3.0 -- but
only in that version -- you can use BASICA to NAME olddir AS newdir.
This is a bug in DOS, however, that was fixed in DOS 3.1. With DOS
3.1 and presumably henceforth a program such as RENDIR is needed.)

RENDIR's general syntax is:

RENDIR [d:][path]sourcename[.ext] targetname[.ext]

RENDIR does not allow changing the disk or directory in which the
subdirectory to be renamed exists. This was done as much for syntax
consistency as for the fact that function 56h does not allow
subdirectories to be moved to another directory when they are renamed.

The exception to the syntax used by the RENAME command is that
wildcard characters (* and ?) are not allowed in source or target
subdirectory names by RENDIR. Function 56h does not allow for them
(for renaming any kind of file), and function 17h (which does allow
wildcards) cannot be used for renaming subdirectories. If you want,
you can program them in yourself, but renaming one subdirectory at a
time seems useful enough.

RENDIR starts out by displaying a copyright message and checking
to see that the version of DOS is 3.0 or later. RENDIR has only one
quirk, namely, you shouldn't try to rename the subdirectory you are
currently in. DOS gets confused as to what has occurred and doesn't
immediately notice that the current pathname is no longer valid. The
current directory name will not immediately change. As a result, if
you issue a DIR command for the current directory, it will look as if
nothing has changed.

On the other hand, if you then issue any command that requires
DOS to change the current directory temporarily, quite a bit will
change, because DOS will not be able to return to the current (now
renamed) subdirectory. The reason is that the old pathname is no
longer valid. Consequently, DOS will leave the current directory set
to whatever subdirectory had to be temporarily accessed.

The DIR and CHKDSK commands illustrate the difficulties
encountered if you try to rename your current directory. If you ask
DIR to list files in any subdirectory except the current one, it
changes the current directory internally, lists all files, and then
changes the current directory back to the original one.

This is usually transparent to you, but if you have used RENDIR
to rename the current subdirectory, you'll know all about it because
then DIR is done, the current directory will be the one DIR changed
to, not the one you started with. Similarly, CHKDSK always changes
the current directory to the root directory before it does its work.
If you have renamed the current directory using RENDIR and then issue
a CHKDSK command, you'll wind up with the current directory set to
the root directory.

Nothing gets destroyed or damaged, but it seems best to avoid
this quirk. Avoiding it is actually simpler than encountering it.
RENDIR's syntax makes renaming the current directory difficult because
you have to specify the full pathname. DOS dot (. and ..) notation
will not work because path specifications are not allowed in the
target name. In fact, RENDIR's syntax is structured so that renaming
a subdirectory of your current directory is the easiest job of all,
and that's probably the way you would naturally want to use it most
of the time. It's perfectly safe in any case, but quirks should be
avoided wherever possible.

 December 25, 2017  Add comments

Leave a Reply