Below is a TCCLE batch file that defines several useful aliases. Once this is run (it should be included in tcstart.bat in C:\Program Files\JPSoft\TCxx) it defines the aliases until that TCCLE session ends. The utilities are described below.
: Create a directory join to the current directory in the current directory alias CLONEDIR=`mklnk "%_cwd" %@quote[-%@name[%_cwp]]`
: Create a hard link to the specified file in the same directory with a minus appended alias CLONEDOC=`mklnk %@quote[%@lfn[%1]] %@quote[%@lfn[%1]-]`
: Do math alias MATH=`Echo %@eval[%&]`
: Select drive, then directory, then show : You need to install the sel-dir.btm file in the appropriate folder alias SD=`"c:\Program Files\JPSoft\sel-dir"`
: Create a temp drive alias TDRv=`subst %1: "%_cwd" & %1:`
CLONEDIR is used where you have multiple programs that create the same type of files. For instance, Paint Shop Pro, Adobe Photoshop Elements, and many other programs install stock images such as flowers, animals, buildings, etc. Usually each program installs those in C:\Program Files\ProgramName\Images or something similar, and they can take up hundreds of megabytes.
I'll use two programs as examples: Program A installs \Program A\Graphics and Program B installs \Program B\Images. Each expects to find its files in that spot.
With CloneDir, you install Program A and then Program B. Go back to \Program A\Graphics and in TCCLE type "CloneDir". In \Program A\Graphics it will create a directory join name -Graphics.
Next, go to \Program B\ rename the \Images folder, e.g., \Images-orig.
Then cut, paste and rename the -Graphics join in \Program B\
In other words, the directory structure will now look like this, all descended from C:\Program Files\
\Program B\Images \Program B\Images-orig
When you list \Program B\Images, you will see the same content as \Program A\Graphics
Now move everything from \Images-orig into the \Program B\Images folder.
The result will be that each program will see the files it expects to see but each will have access to all the files from both programs--without having to duplicate the files.
CAUTION! -- Once you have run CloneDir, immediately move the directory join! What CloneDir does is create a join in the folder it is pointing to! In other words, it creates an endless loop.
A directory join and a junction are similar but not identical. Functionally they are like Windows shortcuts. A difference is that a shortcut literally points somewhere else. If the target file or folder is moved or renamed the shortcut "breaks". A directory join or junction is a second pointer to the actual physical file. Hence, even if the original file/folder is "deleted", the actual file/folder will continue to exist because it has two names. Many programs will not use a shortcut, the actual folder name must be used. With a directory join/junction, the programs see the actual folder, not a shortcut.
In addition to having all the graphics programs use the same folders, I also use it for Favorites. I have a folder C:\Most Used which is my actual favorites folder. With other programs, I delete their Favorites folder and use a directory join to C:\Most Used and I rename the join to whatever that program expects.
CLONEDOC is similar to CloneDir except that it creates a hard link to a file instead of a directory join/junction. This has several uses:
1) You may need access to a single file from multiple locations, e.g., each user accesses C:\Reference Data\Phone Book.2009.txt and that file needs to remain current. If files are moved from time to time (e.g., Active moved to Closed) and reorganized, shortcuts will break but a hard link won't.
2) A clone can be used for security. The physical file is not deleted until every hard link is deleted. (Every file has at least one hard link--the name it is currently saved under.)
3) For convenience you may need to refer to the same file by multiple names (e.g., Hamilton Report.2Q2008.pdf and Undisbursed Funds.2Q2008.pdf). (This is particularly useful in a highly political environment where some high-up jerk refuses to follow naming conventions and gets mad if subordinates rename files. Just create a clone link somewhere else that follows the naming convention. Even if the user moves or renames the file the clone link will still work.)
MATH does quick command-line math. Just type MATH and whatever you want to calculate and it will show the result.
SD calls the sel-dir.btm tree-walker utility.
TDRV creates a temporary drive at the current location using the DOS SUBSTitute command. This is particularly useful when you are 8 levels down and need to move or copy things to someplace else 6 levels down. You go to your source directory (... use SD ...) and type TDRV G, go to your target directory and type TDRV H. Then you can copy/move from Drive G: to Drive H: instead of a long path.
The temporary drives will last until reboot or you can use SUBST /D Driveletter: from a command prompt.
|