Computer file

From Free net encyclopedia

This article discusses computer files and file systems in general terms. For a more detailed and technical discussion, see File system.

A computer file is a collection of information that is stored in a computer system and can be identified by its full path name. Computer files are so called because they are the computer equivalent of card, paper, or microfiche files in the traditional office environment. Computer files provide a way to organize the resources used to permanently store information inside a computer.

Contents

File Content

As far as the operating system is concerned, a file is in most cases simply a one-dimensional stream of bytes (whole numbers in the range of 0 to 255), which is treated by the operating system as a single logical unit. A computer data file usually has a size, which is normally expressed in bytes; in all modern operating systems, the size can be any whole non-negative number of bytes up to a system-dependent maximum. It is up to software running on the computer to interpret this very simple basic structure as e.g. a program, a text, or an picture, based on its name and content. Special types of files, e.g. device nodes symbolically representing pieces of hardware, do not consist of a stream of bytes and do not use file sizes.

Information in a computer file usually consists of smaller packets of information (often called records or lines) that are individually different but share some trait in common. For example, a payroll file might contain information concerning all the employees in a company and their payroll details; each record in the payroll file concerns just one employee, and all the records have the common trait of being related to payroll—this is very similar to placing all payroll information into a specific filing cabinet in an office that does not have a computer. A text file may contain lines of text, corresponding to printed lines on a piece of paper.

The way information is grouped into a file is entirely up to the person designing the file. This has led to a plethora of more or less standardized file structures for all imagninable purposes, from the simplest to the most complex. Most computer files are used by computer programs. These programs create, modify and delete files for their own use on an as-needed basis. The programmers who create the programs decide what files are needed, how they are to be used and (often) their names.

In some cases, computer programs manipulate files that are made visible to the computer user. For example, in a word-processing program, the user manipulates document files that she names herself. The content of the document file is arranged in a way that the word-processing program understands, but the user chooses the name and location of the file, and she provides the bulk of the information (such as words and text) that will be stored in the file.

Many applications pack all their data files into a single file, using internal markers to discern the different types of information contained within. The data files used by games such as Doom and Quake are examples of this.

Files on a computer can be created, moved, modified, grown, shrunk and deleted. In most cases, computer programs that are executed on the computer handle these operations, but the user of a computer can also manipulate files if necessary. For instance, Microsoft Word files are normally created and modified by the Microsoft Word program in response to user commands, but the user can also move, rename, or delete these files directly by using a file manager program such as Windows Explorer (on Windows computers).

Identifying and organizing files

Image:FileFolders.jpg In modern computer systems, files always have names. Files are located in directories. A file's name within a directory must be unique. In other words, no two files in a directory may have the same name.

A file's name and the path to the file's directory uniquely identifies it among all other files in the computer system—no two files can have the same name. The appearance of the name depends on the type of computer system being used. Early computers permitted only a few letters or digits in the name of a file, but modern computers allow long names containing almost any combination of letters or digits, making it easier to understand the purpose of a file at a glance. Some computer systems allow file names to contain spaces; others do not. Case-sensitivity of file names is determined by the file system. Unix file systems are usually case sensitive and allow user-level applications to create files whose names differ only in the case of characters. Microsoft Windows supports multiple file systems, each with different policies regarding case-sensitivity. The common FAT file system can have multiple files whose names differ only in case if the user uses a disk editor to edit the file names in the directory entries. User applications, however, will usually not allow the user to create multiple files with the same name but differing in case.

Most computers organize files into hierarchies called folders, directories, or catalogs. (The concept is the same irrespective of the terminology used.) Each folder can contain an arbitrary number of files, and it can also contain other folders. The other folders can contain still more files and folders and so on, thus building a tree-like structure in which one “master folder” (or “root folder”—the name varies from one computer to another) can contain any number of levels of other folders and files. The folders can be named just as files can (except for the root folder, which often does not have a name). The use of folders makes it easier to organize files in a logical way.

When a computer allows the use of folders, each file and folder has not only a name of its own, but also a path, which identifies the folder or folders in which a file or folder resides. In the path, some sort of special character—such as a slash—is used to separate the file and folder names. For example, in the illustration shown in this article, the path /Payroll/Salaries/Managers uniquely identifies a file called Managers in a folder called Salaries, which in turn is contained in a file called Payroll. The folder and file names are separated by slashes in this example; the topmost or root folder has no name, and so the path begins with a slash (if the root folder had a name, it would precede this first slash).

Many (but not all) computer systems use extensions in file names to help identify what they contain. On Windows computers, extensions consist of a dot or period at the end of a file name, followed by a few letters to identify the type of file. An extension of .txt identifies a text file; the .doc extension identifies any type of document or documentation, commonly in the Microsoft Word file format; and so on. Even when extensions are used in a computer system, the degree to which the computer system recognizes and heeds them can vary; in some systems, they are required, while in other systems, they are completely ignored if they are present.

Protecting files

Many modern computer systems provide methods for protecting files against accidental and deliberate damage. Computers that allow for multiple users implement file permissions to control who may or may not modify, delete, or create files and folders. A given user may be granted only permission to modify a file or folder, but not to delete it; or a user may be given permission to create files or folders, but not to delete them. Permissions may also be used to allow only certain users to see the contents of a file or folder. Permissions protect against unauthorized tampering or destruction of information in files, and keep private information confidential by preventing unauthorized users from seeing certain files.

Another protection mechanism implemented in many computers is a read-only flag. When this flag is turned on for a file (which can be accomplished by a computer program or by a human user), the file can be examined, but it cannot be modified. This flag is useful for critical information that must not be modified or erased, such as special files that are used only by internal parts of the computer system. Some systems also include a hidden flag to make certain files invisible; this flag is used by the computer system to hide essential system files that users must never modify

Storing files

In physical terms, most computer files are stored on hard disks—spinning magnetic disks inside a computer that can record information indefinitely. Hard disks allow almost instant access to computer files.

On large computers, some computer files may be stored on magnetic tape. Files can also be stored on other media in some cases, such as writeable compact discs, Zip drives, etc.

Backing up files

When computer files contain information that is extremely important, a back-up process is used to protect against disasters that might destroy the files. Backing up files simply means making copies of the files in a separate location so that they can be restored if something happens to the computer, or if they are deleted accidentally.

There are many ways to back up files. Most computer systems provide utility programs to assist in the back-up process, which can become very time-consuming if there are many files to safeguard. Files are often copied to removable media such as writeable CDs or cartridge tapes. Copying files to another hard disk in the same computer protects against failure of one disk, but if it is necessary to protect against failure or destruction of the entire computer, then copies of the files must be made on other media that can be taken away from the computer and stored in a safe, distant location.

File systems and file managers

The way a computer organizes, names, stores and manipulates files is globally referred to as its file system. All computers have at least one file system; some computers allow the use of several different file systems. For instance, on newer Windows computers, the older FAT and FAT32 file systems of old versions of Windows are supported, in addition to the NTFS file system that is the normal file system for recent versions of Windows. NTFS is not newer than FAT32; it has existed since Windows NT was first released in 1993. Each system has its own advantages and disadvantages. Standard FAT allow only eight-character file names (plus a three-character extension) with no spaces, for example, whereas NTFS allows much longer names that can contain spaces. You can call a file Payroll records in NTFS, but in FAT you would be restricted to something like payroll.dat (unless you were using VFAT, a FAT extension allowing long file names).

File-manager programs are utility programs that allow you to manipulate files directly. They allow you to move, create, delete and rename files and folders, although they do not actually allow you to read the contents of a file or store information in it. Every computer system provides at least one file-manager program for its native file system. Under Windows, the most commonly used file manager program is Windows Explorer.

See also

External links and references

ca:Fitxer informàtic da:Fil (dataobjekt) de:Datei et:Fail es:Archivo informático eo:Dosiero fa:پرونده (رایانه) fr:Fichier (informatique) fy:Triem ko:파일 it:File he:קובץ lt:Failas hu:Fájl ja:ファイル (コンピュータ) nl:Bestand (computer) no:Datafil pl:Plik pt:Arquivo ru:Файл sk:Súbor (informatika) sl:Datoteka vi:Tập tin zh:计算机文件