Sunday, October 7, 2007

Hmnnnn Wild?

Wild Card Character

A special symbol that stands for one or more characters. Many operating systems and applications support wild cards for identifying files and directories. This enables you to select multiple files with a single specification.

For example: In Windows, the asterisk (*) is a wild card that stands for any combination of letters. The file specification m* therefore, refers to all files that begin with m. Similarly, the specification m*.doc refers to all files that start with m and end with .doc. Many word processors also support wild cards for performing text searches.


The Question mark

wild card [?] matches any single character. For instance, the file spec [?SALES.DOC] includes all files that start with any character; the remaining letters must be [SALES], and the file must have the extension [DOC]. The following files would be included in this group:

ESALES.DOC
WSALES.DOC
SSALES.DOC
NSALES.DOC

The following files would not be included:

SWSALES.DOC (matches only 1 character)
ESALES.XLS (extensions dont match)

Like all operating systems, Unix files have names. (Unix directories, devices, and so on also have filenames — and are treated like files (Section 1.19).) The names are words (sequences of characters) that let you identify a file.

Older versions of Unix had some restrictions on the length of a filename (14 characters), but modern versions have removed these restrictions for all practical purposes. Sooner or later you will run into a limit, but if so, you are probably being unnecessarily verbose.

Technically, a filename can be made from almost any group of characters (including nonprinting characters and numbers) except a slash (/).

However, you should avoid filenames containing most punctuation marks and all nonprinting characters. To be safe, limit your filenames to the following characters:

Upper- and lowercase characters
Unix filenames are always case sensitive. That is, upper- and lowercase letters are always different (unlike Microsoft Windows and others that consider upper- and lowercase letters the same).

Therefore, myfile and Myfile are different files. It is usually a bad idea to have files whose names differ only in their capitalization, but that's your decision.
Underscores (_)

Underscores are handy for separating "words" in a filename to make them more readable. For example, my_long_filename is easier to read than mylongfilename.
Periods (.)

Periods are used by some programs (such as the C compiler) to separate filenames from filename extensions. Extensions are used by these programs to recognize the type of file to be processed, but they are not treated specially by the shell, the kernel, or other Unix programs.

Filenames that begin with a period are treated specially by the shell: wildcards won't match them unless you include the period (like .*).

The ls command, which lists your files, ignores files whose names begin with a period unless you give it a special option (ls -a. Special configuration files are often "hidden" in directories by beginning their names with a period.

Directory Organization

Think about how you store letters in your office. In your office, you may have a filing cabinet.

In that filing cabinet, you probably have folders that pertain to different projects, employees, organizations, or some other grouping--maybe logical, maybe not.

Within each folder you have articles, letters, diagrams, reports--anything that you want to save. This storage method carries over to Microsoft's MS-DOS and Windows 95/98 Disk Operating Systems (DOS).

With Microsoft's DOS, a disk is like a filing cabinet. Within that disk, you have directories or areas set aside for certain files such as memos, articles, or diagrams. The same type items that you store in a folder are stored in electronic form in a file. That file is then stored in a directory.

Root Directory and the Path

The main directory is called the root directory. All other directories are branches of this directory, much like the roots of a tree. Directories can contain files, programs, or other directories. The root directory is designated by a backslash (\).

To get to a particular file, you must trace the path from the root directory to the directory that the file is located in. The path is the list of directories, starting with the root.

Each directory name is separated by a backslash (\). For example, the path [C:>\wp\reports] gives you access to the directories as follows:

Start at drive C:\
Go from the root directory (\) to the [ WP] directory
Go from the [WP] directory to the [REPORTS] directory.

When we go to a directory it is the same as opening a folder in a file drawer.

Note: The paths for each of these directories would look like the following:
C:\ ----------------------------- Root Directory
C:\dos\ ----------------------- DOS subdirectory (1 level)
C:\Lotus\ --------------------- Lotus Subdirectory (1 Level)
C:\wp\ ------------------------- Word Perfect Subdirectory (1 level)
C:\wp\Report ---------------- Report Subdirectory (2 levels)

Drive Identification

Microsoft's Disk Operating Systems identify each drive (including the hard disk) by a letter. For example the first diskette drive on any system is always drive [A:] and the second is always drive [B:], etc. On some systems drive "A" is a 3-1/2 inch floppy drive.

On other systems it can be a 5-1/4 floppy drive.

The first logical or physical hard disk is always identified as [C:].

To specify the disk drive in a path statement you always give the drive letter followed by a colon.

Examples: For each hard disk or Floppy disk, the top level directory is always called the [ROOT] directory.

Sub-directories - Since one directory can contain entries for other directories, the subordinate directories can be referred to as subdirectories.

These subdirectories are just like any other directory; they're just subordinate to a higher-level directory.

As a result, subdirectories can also be referred to as directories.
This is the same as a letter in a file is a subordinate to the higher level file folder

No comments: