Chapter 5 - Managing Directories and Files

Previous Chapter : Next Chapter : Top


Table of Contents


This chapter discusses how to manage the directories and files in your Directory Windows.

You will learn how to:


Creating Directories and Files

Use the Create Menu in a Directory Window to create directories, files, FIFOs, and devices. (FIFOs and devices are like files, but are used specifically to communicate between programs or to peripheral devices.)

If the Directory, File, FIFO, and Device commands are dimmed in the Create Menu, you do not have write permission for the current directory. For more information about access permissions, refer to Chapter 6, "Viewing and Changing Directory and File Attributes."

Creating Directories

  1. Choose Directory from the Create Menu in a Directory Window.
    The new directory is named Directory1 and its name is selected. Each new directory you create is consecutively numbered until you rename it.

  2. To rename the new directory, type the new name while it is still selected.

Creating Files or FIFOs

  1. Choose File or FIFO from the Create Menu in a Directory Window.
    If you created a new file, the new file is named File1 and its name is selected. Each new file you create is consecutively numbered until you rename it.
    If you created a new FIFO, the new file is named FIFO1 and its name is selected. Each new FIFO you create is consecutively numbered until you rename it.

  2. To rename the new file or FIFO, type the new name while it is still selected.

Creating Devices

Creating a device is not an everyday activity for most users. On most systems, only a super-user or system administrator can create devices.

If you create a device, you must make sure the device driver it references is properly installed in the operating system kernel.

  1. Choose Device from the Create Menu in a Directory Window.

    The Device dialog is displayed:

  2. Select the Block or Character button in the Device Type section.

  3. Enter the major device number in decimal notation in the Major Device Number field.

  4. Enter the minor device number in decimal notation in the Minor Device Number field.

  5. Click OK.

    The new device is named Device1 and its name is selected. Each new device you create is consecutively numbered until you rename it.

  6. To rename the new device, type the new name while it is still selected.

Changing the Name of an Existing Directory or File

There are two ways to change the name of a directory or file using the Desktop:

The following section tells you how to change the name of a directory or file in a Directory Window. To find out how to use the Information command to change a directory or file name, refer to Chapter 6, "Viewing and Changing Directory and File Attributes."

  1. Select the name of the directory or file you want to change.
    A box appears around the directory or file name and the name is highlighted.

  2. Edit the name just as you would any text field.
    The Desktop allows you to change the name of all directories and files in your directory except the "." (current) and ".." (parent) directories.
    If you make a mistake, delete the entire name and press Return. The old name is restored.

Creating Links

A link lets you access a directory or file from more than one location in a file system or directory hierarchy. A file system is a set of directories and files that can be mounted (connected) or unmounted (disconnected). Links provide access to directories or files by giving them additional names (called linked references). You use a different type of link depending on how you want to reference a directory or file. Symbolic links take up very little disk space---much less than an actual copy of a directory or file. You can view or make changes to a file or directory through a link.

You can create two types of links with the Desktop:

A key distinction between hard and symbolic links is that a hard link is a reference to a physical file and a symbolic link is a reference to a directory or file name.

Hard links can only be created for files; they cannot be created for directories. The link may be in a different directory, but it must be on the same file system.

A file is not removed from your system until all of its hard link names have been removed. One way to find out how many hard links a file has is to use the Information command in the File Menu of any Directory Window. Another way is to use the Wide view option in the Directory Window of the file; the links are shown in the Links column. For more information on the Information command, refer to "Accessing Information for One Directory or File."

Unlike a hard link, a symbolic link can be made across file systems and can reference directories as well as files. When you create a symbolic link, a file is created that contains the pathname of the actual directory or file. As with a hard link, you can view or make a change to a file through any of its symbolic links.

Because a symbolic link only points to a directory or file name and is not an actual file system reference, when you remove the original directory or file you also make all of its symbolic links invalid. The link is still there, but since it points to nothing, the link causes errors if you try to use it. The symbolic link becomes available again if you put a file with the same name in the same location.

There are two types of symbolic links:

An absolute symbolic link is a full pathname that leads to the original directory or file. Because it explicitly refers to each directory in the pathname, you would create an absolute symbolic link if you intend to keep the original directory or file in the same location in the directory structure. However, you can move the linked reference because its location does not determine the reference. If you remove, move, or change the name of the original directory or file, you cannot access that directory or file because the pathname is invalid.

A relative symbolic link is a relative pathname that leads to the original directory or file. The location of the linked reference is used to determine the location of the original directory or file, so one cannot move relative to the other without making the link invalid. Relative symbolic links let you move the portion of the directory structure containing the original directory or file and the linked reference within the file system.

For more information about the types of links supported by your system, refer to the system documentation for Linux.

Another way to quickly access a directory or file is to put it on the Desktop.

Creating a Hard Link

  1. Select the files that you want to create a link for.

  2. Choose Link... from the File Menu in the Directory Window.
    The Link Files And Directories Window is displayed:

  3. Specify where the linked reference will appear and what it will be named by doing on of the following:

  4. Select Hard to create a hard link.
    If you try to create a hard link with the same name as a file that currently exists in the directory you want to put the hard link in, a message alert is displayed asking if you want to overwrite the existing file.

  5. Click OK to save your changes and exit the Link Files and Directories Window.
    You can also click Apply to save your changes without closing the window.
    The link is created in the directory you chose. If you are creating links for several files at one time, a status dialog is displayed.
    If a status dialog is displayed, you can cancel the unfinished part of the operation by clicking Cancel in the status dialog.

Creating a Symbolic Link

If the Relative Symbolic and Absolute Symbolic buttons do not appear in the Link Files And Directories Window, you are viewing a filesystem that does not support symbolic links (for example, an automounted NetWare volume).

  1. Select the directories or files that you want to create a link for.

  2. Choose Link... from the File Menu in the Directory Window.
    The Link Files And Directories Window is displayed:

  3. Specify where the linked reference will appear by doing one of the following:

  4. Select the appropriate button for the type of link you want to create:

  5. Click OK to save your changes and exit the Link Files And Directories Window.
    You can also click Apply to save your changes without closing the window.
    The link is created in the directory you chose.
    If you are creating links for several directories or files at one time, a status dialog is displayed.
    If a status dialog is displayed, you can cancel the unfinished part of the operation by clicking Cancel in the status dialog.
    You can set the access permissions for symbolic links but not for hard links. For information about setting access permissions, refer to "Changing Access Permissions."

Finding Directories and Files

Use the Find command to search your file system for a specific directory or file. The Find command is available from two menus in the Desktop:

In the Find Window, you specify a name or a pattern (using special characters) that you want the Desktop to search for. The Desktop lists the names of matching directories and files in the scrolling list. You can then select a directory or file in the list and click the Show button in the Find Window to display it in a Directory Window.

To learn how to select directories or files that you already know the location of, refer to "Selecting Directories and Files."

When you use the Find Window to search for a file or directory, you enter a pattern that the Desktop matches for you. The following table describes the special characters that you can use in the search pattern.

Table 5. Special characters used in a pattern for the Find Window

---------------------------------------------------------------------------------
To specify a pattern that includes:                           Use this character:  
---------------------------------------------------------------------------------
A single, variable character.                                 ?                    

For example, memo? finds all names that begin with memo                            
followed by exactly one character (like memo1 or memoX, but                        
not memo, memo10, or memoXY).                                                      

One character from a set of characters.                       [ ]                  

For example, Wor[dkm] finds names that begin with Wor and                          
end in d, k, or m (Word, Work, Worm).                                              

Zero or more variable chracters.                              *                    

For example, *.c finds any names with the .c extension                             
(Paper.c, PROG.c, Classworkprog.c).                                                
---------------------------------------------------------------------------------

Finding All Names that Match a Pattern

  1. Choose Find... from one of these menus:

  2. In the Name Pattern field, enter the name of the directories or files you want to find or a pattern that will match the names you want.
    You cannot prefix a pattern with the ? or the * character to match names that begin with a "." (dot).

  3. Select the check boxes for the items (such as directories, files, devices, or FIFOs) that you want to find.

  4. Verify the path in the Search Within field.
    If you need to change the path, edit it.
    When you choose the Find command from the Windows Menu in the Desktop Window, this field defaults to the root directory (/).
    When you choose Find from the Select Menu in a Directory Window, this field defaults to the pathname of the directory displayed in the currently active Directory Window.

  5. Select Search Subdirectories to include all subdirectories of the path in the search.
    If you unselect this check box, the Desktop searches only the specified directory.

  6. Click Find.
    The Desktop begins searching your file system. The subdirectories it is searching are displayed in the Searching field.
    At this point, you can wait for the operation to finish, or you can continue your work in another window. When the search is complete, the Desktop beeps.

  7. At any time during the search, you can click any of the following:

  8. Display a directory or file located with the Find Command by double-clicking the name of the object you want to display in the list within the Find Window.
    You can also select the name of the directory or file you want, then click Show.
    A Directory Window is displayed (or brought to the foreground if already open) with the selected directory or file highlighted.

Selecting Directories and Files

If you know that the directory or file you are looking for is in the active Directory Window, you can find and highlight it using the Select Menu.

With this menu, you can select all the directories or files in the active Directory Window, or you can select directories and files in the active Directory Window that match a name or pattern (using special characters).

Selecting Names in a Directory Window that Match a Name or Pattern

  1. Choose Select By Pattern... from the Select Menu in a Directory Window.
    The Select Items By Pattern Window is displayed:

    In this window, you specify a name or pattern to match the directories or files you want to select.
    Refer to Table 5 for a description of the special characters you can use to specify a directory or file.
    You cannot prefix a pattern with the ? or the * character to match names that begin with a "." (dot).

  2. In the Pattern field, enter the name of the directory or file you want to select or a pattern for the names you want to select.

  3. In the Action section, choose one of the following:

  4. In the Selection section, make sure the check boxes for the objects you want are selected:

  5. Click OK.
    Any directories and files that match the pattern are selected or unselected in the current Directory Window.
    If any directories or files are already selected, they remain selected when you use the Select By Pattern command.

Selecting All Files or All Directories in a Directory Window

  1. Choose Select All Files or Select All Directories from the Select Menu in a Directory Window.
    All files or all directories are selected in the current Directory Window.

Grouping Selected Directories and Files

Sometimes it is useful to group all selected directories or files in a Directory Window. The Group Selected Objects command groups any selected directories or files first, then lists the rest of the directories and files. This command is only available when the Directory Window contains the splitter.

  1. If the directories and files you want displayed first are not already selected, select them.

  2. Choose Group Selected Objects from the Sort Menu in the Directory Window.
    The selected directories or files are listed together.


Moving Directories

In the Desktop, you can move directories by using mouse actions or the Move command from the File Menu. You can only move directories within the same file system.

There are two ways to move a directory from one directory to another:

Moving Directories by Dragging

If the directory you want to move a directory into (the destination directory) is displayed on your workspace, you can drag the directory to its new location.

  1. Select the directory or directories you want to move.

  2. Drag the selected directories to one of the following:

Moving Directories with the Move Command

  1. Select the directory or directories you want to move.

  2. Choose Move from the File Menu in the Directory Window.
    The Move Items To Directory Window is displayed:

  3. Specify the directory you want to move directories to (the destination directory) by doing one of the following:

  4. Click OK to move the items to the new directory.
    You can also click Apply to move the selection without closing the Move Items To Directory Window.
    If you move several directories at one time, a status dialog displays the progress of the move operation.
    If a status dialog is displayed, you can cancel the unfinished part of the move operation by clicking Stop in the dialog.

Moving and Copying Files

In the Desktop, you can move and copy files by using mouse actions or the Move and Copy commands from the File Menu.

Moving Files

There are two ways to move a file from one directory to another:

Moving Files by Dragging

If the directory you want to move a file into is displayed on your workspace, you can drag the file to its new location.

  1. Select the files you want to move.

  2. Drag the selected files to one of the following:

Moving Files with the Move Command

  1. Select the files you want to move.

  2. Choose Move... from the File Menu in the Directory Window.
    The Move Items To Directory Window is displayed:

  3. Specify the directory you want to move files to by doing one of the following:

  4. Click OK to move the items to the new directory.
    You can also click Apply to move the selection without closing the Move Items To Directory Window.
    If you move several files at one time, a status dialog displays the progress of the move operation.
    If a status dialog is displayed, you can cancel the unfinished part of the move operation by clicking Stop in the dialog.

Copying Files

There are two ways to copy files in the Desktop:

Copying Files by Dragging

If the directory you want to copy a file into is on your Desktop or in an open Directory Window, you can drag the file to the new location to put a copy of it there.

  1. Select the files you want to copy.

  2. Hold down the Control key.

  3. Drag the selected files to one of the following:

    If you copy large files or several files at one time, a status dialog displays the progress of the copy operation.
    If a status dialog is displayed, you can cancel the unfinished part of the copy operation by clicking Stop in the dialog.

Copying Files with the Copy Command

  1. Select the files you want to copy.

  2. Choose Copy... from the File Menu in the Directory Window.
    The Copy Items To Directory Window is displayed:

  3. Specify the directory you want to copy to by doing one of the following:

  4. Click OK to copy the files to the new directory.
    You can also click Apply to copy the selection without closing the Move Items To Directory Window.
    If you copy large files or several files at one time, a status dialog displays the progress of the copy operation.
    If a status dialog is displayed, you can cancel the unfinished part of the copy operation by clicking Stop in the dialog.

Removing Directories and Files

In the Desktop, you can delete directories and files from your system with the Remove command from the File Menu.

Depending on how you have set your preferences, when you remove a file, it may be deleted permanently. When you remove a directory, the directory and all of the files and subdirectories it contains may be deleted permanently.

If you accidentally remove something, see your system administrator---it may be recoverable from a backup.

Removing Directories or Files

  1. Select the directories and files you want to remove.

  2. Choose Remove from the File Menu in the Directory Window.
    One or more confirmation dialogs may be displayed.
    If you select directories and files, the Desktop displays a dialog asking you if you really want to remove both directories and files. Other dialogs may be displayed, depending on the level of confirmation selected in your removal preferences. For more information about setting removal preferences, refer to "Changing Removal Preferences."

  3. In a confirmation dialog, click Yes to confirm the removal.
    Clicking No will cancel the removal.
    If you remove large directories and files or several directories and files at one time, a status dialog displays the progress of the remove operation.
    If a status dialog is displayed, you can cancel the unfinished part of the remove operation by clicking Stop in the dialog.

The Trash Window

You can use the Trash Window to view the contents of the Trash, displaying them in Name or Icon view. You can also:

Opening the Trash Window

  1. Double-click the Trash icon on the Desktop.
    The Trash Window is displayed.

Changing the View of Items in the Trash Window

  1. Select Name from the View Menu to view items by name.
    You can also select Icon from the View Menu to view items by icon, or select Cleanup from the View Menu to align items along an invisible grid.

Displaying the Original Location of Items in the Trash

  1. Select an item or items in the Trash Window.

  2. Select Show Origin... from the File Menu to view the full pathname of the item's origin.
    The Origin Window is displayed:

    You can also select Information to open an Information Window for the item.

Emptying the Trash

  1. Select Empty Trash from the File Menu in the Trash Window or in the Desktop Window.
    The trash is emptied.
    The items are permanently removed from your system.

Printing Files

You can print files with the Print command from the File Menu.

Printing a File

  1. Select the files you want to print.

  2. Choose Print from the File Menu in the Directory Window.
    The Desktop prints the files. If you select a file that is not printable, the Desktop displays a dialog telling you that it will not be printed.

When the Desktop prints a file, it uses two commands: one to format the file and one to spool it to the printer. You can specify the print formatter and spooler commands as part of your execution preferences. For information about execution preferences, refer to "Changing Execution Preferences." For information about assigning print commands for specific file types, refer to "Building the Command Section."

The formatter command processes the file for printing---it may paginate the document or put in headers. The spooler receives the data produced by the formatter command and sends it to the printer.

When you choose the Print command from the File Menu, the Desktop checks to see if the file is printable. If it is, the Desktop checks to see if a special formatting command is defined for that type of file. If there is one, the Desktop uses it. If there is no special command, the Desktop uses the command from the user's execution preferences.

The output of the formatting step is then sent to the spooler command specified in the user's execution preferences.