• Keine Ergebnisse gefunden

USING AND NAMING FILES

Im Dokument INTER ACTIVE (Seite 46-52)

VP fix and MS-DOS Primer

USING AND NAMING FILES

This section reviews how DOS files are used and named. In this sec-tion you will learn:

• What a file is.

• How to name a DOS file.

• How to name a file so that it is acceptable to both the DOS and UNIX systems.

• What DOS wildcards are and how to use them in DOS commands.

What Is a File?

A file is a named collection of related information stored on a com-puter, a letter or a report, for example. You create a file each time you enter and save data or text at your terminal. Files are also created when you write, name, and save programs.

Naming DOS and UNIX Files

All programs, text, and data on disks or diskettes reside in files.

Each file has a unique name. In DOS, a complete file name consists of a file name and its extension. File names can be one to eight characters and can contain letters, numbers, and symbols. The optional file name extension can be one to three characters and can contain letters, numbers, and symbols. It must be separated from the file name by a period.

A typical DOS file name looks like this:

FORECAST.EXE

FORECAST is the file name; EXE is the file name extension.

VP/ix and MS-DOS Primer - Release 1.1.0 Examples of other acceptable file names are:

accounts.feb budget.84 smithco.ltr chapter1.nvl CHAP.6A schedule Workup. jun

23

If you use both upper- and lowercase letters in file names, be aware that the DOS system converts all lowercase letters into uppercase.

Therefore, the file names letter, Letter, and LETTER are all viewed by DOS as the same file. It is a good idea to use only lower-case letters in your file names.

The DOS and UNIX operating systems have different file naming conventions. In contrast to DOS file names, UNIX file names can be one to fourteen characters long and can include both uppercase and lowercase letters. In the UNIX system, lowercase letters are not converted to uppercase letters. Therefore, the names let t e r, Letter, and LETTER are all viewed by UNIX as different files.

UNIX file names do not have "extensions," so they can contain more than one period and have more than three characters after a period.

When accessing the UNIX file system through the DOS Z drive, UNIX file names that do not follow the DOS naming conventions will be changed into names that do follow the DOS conventions.

These names will contain one or more tildes (~), so it will be easy to see which UNIX file names do not follow the DOS conventions.

-- To make a UNIX file name identical when viewed through both UNIX and DOS, give it a name that follows all the limits imposed on DOS file names and contains only lowercase letters.

It is probably best to use only letters and numbers in your file names and extensions, although some other characters are allowed.

Invalid File Names

The DOS operating system treats some device names in special ways. Certain three-letter names are reserved for the names of these devices. These three-letter names cannot be used as file

24 VPjix and MS-DOS Primer - Release 1.1.0 names, but can be used as extensions. You must not use any of the following as file names:

AUX Refers to input from, or output to, an auxiliary device, such as a printer or a diskette drive.

COM1 Refers to the first asynchronous communications port.

COM2 Refers to the second asynchronous communications port.

CON Refers to keyboard input, or to output to the terminal console (screen).

LPT1 Refers to the first line or parallel printer.

LPT2 Refers to the second line or parallel printer.

LPT3 Refers to the third line or parallel printer.

NUL Is used when you do not want to create a file, but the command requires an input or output file name.

PRN Refers to the printer.

You may not add device designations or file name extensions to these file names. The DOS operating system assumes that all files that contain these characters refer to the devices listed above. For example, CON. XXX is interpreted as a reference to the console by DOS. It cannot be used to name a file stored on a fixed disk or diskette.

Wildcards

A wildcard is used to match a character or a string of characters in a file or directory name. It is a type of shortcut that can be used in commands that require file names and extensions as arguments. A wildcard is also referred to as a pattern matching character.

VP/ix and MS-DOS Primer - Release 1.1.0 25 Wildcards are convenient because they enable you to use a file name or group of file names without having to type the complete name.

Wildcards can also be used when you only remember part of a file name.

There are two DOS wildcard characters:

? Matches anyone character.

*

Matches zero or more characters.

" , When you create new files, be very careful not to use a wild-card character as part of the file name. It is very difficult to access or remove a file if there is a wildcard character in its name.

WILDCARD FORMAT

DESCRIPTION

? string?

?string

?string?

string??

Substituting a question mark in a file or directory name argument matches anyone character for each ? supplied.

The question mark means that no character or one character can occupy that position. For example, the DOS command:

VP/ix Z: \.usr\'tony> dir test?run. exe

lists all directory entries on the default drive that begin with the string test, have one character or no characters in the next posi-tion, are followed by the letters run, and have a file name exten-sion of . exe. Here are some examples of files that might be listed using the above d i r command:

test1run.exe test2run.exe testhrun.exe

An asterisk (

* )

means that zero or more characters can occupy that position or any of the remaining positions in the file name or exten-sion. For example, the command:

26 VPjix and MS-DOS Primer - Release 1,1.0 VP/ix Z: \usr\tony> dir test*. exe

lists all directory entries on the default drive with file names that begin with the characters test and have an extension of . exe.

Here are some examples of files that would be listed using the above d i r command:

test.exe test 1. exe test2run.exe test6run.exe testall.exe

To list the directory entries for all files named accounts on drive

A (regardless of their file name extensions), type:

VP/ix Z: '\usr,\tony> dir a: accounts. *

To list the directory entries for all files with file name extensions of . txt (regardless of their file names) on the disk in drive B, type:

VP/ix Z:'\usr,\tony> dir b:*.txt

This command is useful if, for example, you have given all your text files a file name extension of . txt. By using the dir command with wildcard characters, you can obtain a list of all your text files even if you do not remember all their names.

The wildcard designation

* . *

refers to all files in the current direc-tory. Note that this can be very powerful and destructive when used with DOS commands. The command:

VP/ix Z: '\usr,\tony> del *. *

deletes all files in the current directory, regardless of file name or extension.

The DOS wildcards are similar to two of the UNIX wildcard charac-ters, ? and

*.

For more information about UNIX wildcard charac-ters, see the "UNIX Primer" in the 386jix Operating System Guide.

For more information about DOS wildcard characters, see the MS-DOS Reference Guide.

VPjix and MS-DOS Primer - Release 1.1.0 27

FILE SYSTEMS AND DIRECTORIES

This section discusses directories and file systems and their place in the DOS system. In this section you will learn:

• What a directory is.

• What a file system is.

• What the root directory is.

• What a path name is.

• Path name shortcuts.

• How to create a directory.

• How to change from one directory to another.

• How to delete a directory.

• How to rename a directory.

Directories

Directories are used to organize files into convenient groups. A directory is a special kind of file that stores other files and informa-tion about the files and subdirectories stored in it. Directories con-tain information about the sizes of the files, their locations on the disk or diskette, and the dates that they were created and last updated. DOS directories are named using the same conventions used for DOS file names.

File Systems

Information on the computer is stored in an organized structure, called a hierarchical file system. A file system is a collection of individual files that are stored on a disk. It is called hierarchical because of its multi-level structure. A single master directory is at the top level, and additional files and directories are defined at vari-ous levels below it.

The master directory for the entire system is called the root direc-tory. It is the highest-level directory in the file system structure and is named backslash (\.) on DOS systems. (On UNIX systems, the root directory is named slash (/).) The root directory contains

28 VPjix and MS-DOS Primer - Release 1.1.0 several directories and each of these directories can contain other directories. Because a hierarchical file system is sometimes visual-ized as a "tree," each new directory created on the system can be viewed as a new branch added to the directory tree.

Here is a diagram of a simple directory structure for a computer user named Diane:

~ paper.sup

Im Dokument INTER ACTIVE (Seite 46-52)