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:
- Create new directories and files
- Create links for directories and files
- Find and display directories and files in Directory Windows
- Select directories and files in the active Directory Window
- Group selected directories and files
- Move directories
- Move files
- Copy files
- Remove directories and files
- Print 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."
- 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.
- To rename the new directory, type the new name while it is still selected.
- 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.
- To rename the new file or FIFO, type the new name while it is still selected.
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.
- Choose Device from the Create Menu in a Directory Window.
The Device dialog is displayed:
- Select the Block or Character button in the Device Type section.
- Enter the major device number in decimal notation in the Major Device Number field.
- Enter the minor device number in decimal notation in the Minor Device Number field.
- 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.
- To rename the new device, type the new name while it is still selected.
There are two ways to change the name of a directory or file using the Desktop:
- Edit the name in a Directory Window
- Use the Information command
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."
- 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.
- 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.
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.
- Select the files that you want to create a link for.
- Choose Link... from the File Menu in the Directory Window.
The Link Files And Directories Window is displayed:
- Specify where the linked reference will appear and what it will be named by doing on of the following:
- Select the directory that you want the linked reference to appear in from the History List.
- In the Link To field, enter the full or relative pathname of the directory you want the link to appear in or the full or relative pathname of the link.
- Clear the Link To field and press Return to create the link in your home directory.
The Link To field also supports directory name completion. If you type a partial name of a directory that is unique and then press the spacebar, that directory name is completed in the Link To field.
If you selected several files, you can only specify a directory path (not a file name).
- 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.
- 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.
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).
- Select the directories or files that you want to create a link for.
- Choose Link... from the File Menu in the Directory Window.
The Link Files And Directories Window is displayed:
- Specify where the linked reference will appear by doing one of the following:
- Select the directory that you want the linked reference to appear in from the History List.
- In the Link To field, enter the full or relative pathname of the directory you want the link to appear in or the full or relative pathname of the file that the link references.
- Press Return to create the link in your home directory.
The Link To field also supports directory name completion. If you type a partial name of a directory that is unique and then press the spacebar, that directory name is completed in the Link To field.
If you selected several files or one or more directories, you can only specify a directory path (not a file name).
- Select the appropriate button for the type of link you want to create:
Relative Symbolic to create a relative symbolic link
- Absolute Symbolic to create an absolute symbolic link
If you try to create a symbolic link with the same name as a file that currently exists in the directory you want to put the symbolic link in, a message is displayed asking if you want to overwrite the existing file.
- 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."
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:
- The Windows Menu in the Desktop Window
- The Select Menu in a Directory Window
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).
---------------------------------------------------------------------------------
- Choose Find... from one of these menus:
The Windows Menu in the Desktop Window
- The Select Menu in a Directory Window
The Find Window is displayed:
In this window, you specify a name or pattern to match the directories or files you want to find.
- 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).
- Select the check boxes for the items (such as directories, files, devices, or FIFOs) that you want to find.
- 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.
- 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.
- 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.
- At any time during the search, you can click any of the following:
Stop to stop the find operation
- Continue to continue a find operation after you have stopped it
- Find to restart a find operation from the beginning after you have stopped it
- Close to quit the find operation after you have stopped it
- 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.
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).
- 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).
- 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.
- In the Action section, choose one of the following:
- Select to select the objects that match the pattern you specified
- Unselect to unselect the objects that match the pattern you specified
- In the Selection section, make sure the check boxes for the objects you want are selected:
Select Files to select files that match the pattern
- Select Directories to select directories that match the pattern
- Select both check boxes to select directories and files that match the pattern
- 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.
- 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.
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.
- If the directories and files you want displayed first are not already selected, select them.
- Choose Group Selected Objects from the Sort Menu in the Directory Window.
The selected directories or files are listed together.
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:
- Drag the directory icon to its new location
- Use the Move command
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.
- Select the directory or directories you want to move.
- Drag the selected directories to one of the following:
- The directory section of a Directory Window
- The name or icon of a directory in a Directory Window or the Desktop 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.
- Select the directory or directories you want to move.
- Choose Move from the File Menu in the Directory Window.
The Move Items To Directory Window is displayed:
- Specify the directory you want to move directories to (the destination directory) by doing one of the following:
- Select a directory from the History List.
- In the Move To field, enter a new directory name or the pathname of a directory.
- Clear the field and press Return to move the items to your home directory.
The Move To field also supports directory name completion. If you type a partial name of a directory that is unique and then press the spacebar, that directory name is completed in the Move To field.
- 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.
In the Desktop, you can move and copy files by using mouse actions or the Move and Copy commands from the File Menu.
There are two ways to move a file from one directory to another:
- Drag the file to its new location
- Use the Move command
If the directory you want to move a file into is displayed on your workspace, you can drag the file to its new location.
- Select the files you want to move.
- Drag the selected files to one of the following:
The file section of a Directory Window
- The name or icon of a directory in a Directory Window or on the Desktop
If you move large files or 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.
- Select the files you want to move.
- Choose Move... from the File Menu in the Directory Window.
The Move Items To Directory Window is displayed:
- Specify the directory you want to move files to by doing one of the following:
- Select a directory from the History List.
- In the Move To field, enter a new directory name or the pathname of a directory.
- Clear the field and press Return to move the files to your home directory.
The Move To field also supports directory name completion. If you type a partial name of a directory that is unique and then press the spacebar, that directory name is completed in the Move To field.
- 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.
There are two ways to copy files in the Desktop:
- Drag them
- Use the Copy command
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.
- Select the files you want to copy.
- Hold down the Control key.
- Drag the selected files to one of the following:
- The file section of a Directory Window
- The name or icon of a directory in a Directory Window or on the Desktop
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.
- Select the files you want to copy.
- Choose Copy... from the File Menu in the Directory Window.
The Copy Items To Directory Window is displayed:
- Specify the directory you want to copy to by doing one of the following:
- Select a directory from the History List.
- In the Copy To field, enter a new directory name or the pathname of a directory.
- Clear the field and press Return to copy the files to your home directory.
The Copy To field also supports directory name completion. If you type a partial name of a directory that is unique and then press the spacebar, that directory name is completed in the Copy To field.
- 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.
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.
- Select the directories and files you want to remove.
- 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."
- 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.
You can use the Trash Window to view the contents of the Trash, displaying them in Name or Icon view. You can also:
- Show the origin or full pathname of items
- Show the date and time an item was placed in the trash
- Retrieve items
- View an Information Window for items
- Double-click the Trash icon on the Desktop.
The Trash Window is displayed.
- 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.
- Select an item or items in the Trash Window.
- 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.
- 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.
You can print files with the Print command from the File Menu.
- Select the files you want to print.
- 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.