Previous Next Chapter

Copying Files and Directories

When copying a single file from one place to another, you need to include only the paths for each. FROM and TO keywords are optional. For clarity, most COPY examples in this book use the TO keyword, but omit the FROM keyword.

To copy a file to an existing directory using optional keywords:

1> COPY FROM DF0: Pix/Fractal3 TO Work:Pictures

To copy the file omitting optional keywords:

1> COPY DF0: Pix/Fractal3 Work:Pictures

To copy a file and rename it at the same time, include the new file name in the TO argument:

1> COPY DF0: Pix/Fractal3 TO Work:Pictures/BestPic

To copy all the files in a directory to another directory, without copying the directory itself or the subdirectories it contains:

1> COPY DF0:Pix TO Work:Pictures

The contents of DF0:Pix are deposited in Work:Pictures, not grouped in their own directory. If Pix contained directories, they are not copied, but any .info files for drawers Pix contained are copied, making it appear at first that the drawers were copied.

To copy all the files in a directory to another directory, copying the directory itself but not the subdirectories it contains:

1> COPY DF0:Pix TO Work:Pictures/Pix

The directory Pix is created in Work:Pictures if it does not already exist. The destination directory does not have to be the same name as the source; you can copy to Work:Pictures/Fractals, for example.

To copy a complete directory and its contents to another directory, use the ALL keyword:

1> COPY DF0:Pix TO Work:Pictures/Pix ALL

Work:Pictures/Pix is a duplicate of DF0:Pix.

To copy only certain files to another directory, use pattern matching if their names are similar:

1> COPY DF0:Pix/Fractal[3-7] TO Work:Pictures/Pix

Files in DF0:Pix with names beginning in Fractal and ending in the digits 3 through 7 are copied.

To copy specific files to another directory, include all the file names. Change to the source directory first to avoid having to enter the full path for each:

1> CD DF0:Pix
1> COPY Fractal3 Julia Dragon TO Work:Pictures/Pix

When copying more than one file at once without using the TO keyword, COPY excepts the last name to be the destination directory. With whole-directory, multiple-file, and pattern matching operations, COPY outputs the names of the files copied and directories created as it executes.

Creating a User-startup File

A User-startup file is the Shell equivalent of the Workbench WBStartup drawer. It is a text file that is executed as a script by the default Startup-sequence. Place here any configuration commands, such as ASSIGNs, and the names of programs you wish to run automatically whenever you boot.

To create a User-startup file:

1> RUN ED S:User-startup

After the ED window opens, enter the commands you want on subsequent lines. For example, you can add some cache buffers to speed floppy access, add a directory of custom commands to the path, and start the screen blanker, by entering these lines:

ADDBUFFERS >NIL: DF0: 25
PATH >NIL: SYS:MyCommands ADD
RUN Blanker CX_POPUP=NO SECONDS=600 ANIMATION=YES

Then save the file and exit by pressing Esc,X,Return. The next time you boot or reboot, these commands are executed. When you have more commands to add, edit the file by entering RUN ED S:User-startup again.

Creating an Assignment

On a floppy-only system, a requester similar to that illustrated in Figure 8-1 usually means that you need to insert the named floppy disk.

Figure 8-1. Sample System Requester

The most likely reason for this requester on a hard disk system, aside from entering a command with a misplaced colon (:), is that an application you are running requires an assignment to be made with the ASSIGN command. This is often done for you by an installation program, but not all applications have an installation program or one that works correctly for all systems.

The assignment tells the application to look on your hard drive instead of a floppy drive for things it needs. If the application is one you use regularly, you should place the ASSIGN statement in your User-startup. When the requester first comes up, however, you can enter the assignment in the Shell and then select the requester's Retry gadget.

To allow you to continue your work with a program installed from a disk called ProFusion to the Work:volume, enter the statement:

1> ASSIGN ProFusion: Work:ProFusion

where the first argument is the volume requested, followed by a colon, and the second argument is the device and directory where ProFusion is installed. Click the Retry gadget after entering the command. If the statement is correct, your application works properly and you should add the statement you entered to your User-startup. If it does not work, the second argument needs to be modified.

Accessing the Expanded ED Menus

The default S:Ed-startup file sets up a series of menus for the ED text editor. There is also an expanded set of menus that is built into ED, containing more options. You can make these available by renaming Ed-startup, which prevents it form being executed.

To allow access to the expanded ED menus, enter the following command:

1> RENAME S:Ed-startup TO S:Ed-startup.not

Working with a Single Shell

Although you can open several independent Shell windows at once, you may wish to avoid cluttering the Workbench screen with several windows. Starting a program from a Shell normally takes over that Shell window while the program is running, forcing you to open another Shell to enter additional commands. Use the following techniques to avoid this and allow any number of programs to run from a single Shell.

To run a program in the background so that the Shell window prompt returns, use the RUN command:

1> RUN DMC OPT def RHYME on
[CLI 2]
1>

The message in square brackets indicates the number of the new process started to run the program. The prompt returns immediately.

Even when a program is run this way, the Shell window cannot be closed until all programs started from it are exited. To avoid this, you can detach the program using redirection.

To detach a program, RUN it, adding output redirection to the NIL: device:

1> RUN >NIL: MultiView 8SVX/Sample
[CLI 2]
1>

You can now close the Shell window if necessary.

Note:

Redirection to NIL: also prevents any console output the program produces from appearing in the Shell window.

Top Previous Next Chapter