All Topics  
Computer file

 
Computer File

   Email Print
   Bookmark   Link






 

Computer file



 
 
A computer file is a block of arbitrary information, or resource for storing information, which is available to a computer program
Computer program

Computer programs are Instruction for a computer. A computer requires programs to function. Moreover, a computer program does not run unless its instructions are executed by a Central processing unit; however, a program may communicate an Algorithm#Formalization of algorithms to people without running....
 and is usually based on some kind of durable storage
Computer storage

Computer data storage, often called storage or memory, refers to computer components, devices, and recording medium that retain digital data used for computing for some interval of time....
. A file is durable in the sense that it remains available for programs to use after the current program has finished. Computer files can be considered as the modern counterpart of paper document
Document

A document is a bounded physical representation of body of information designed with the capacity to communication. A document may manifest symbolic, diagrammatic or sensory-representational information....
s which traditionally were kept in offices' and libraries' files
Filing cabinet

A filing cabinet is a piece of office furniture usually used to store paper documents in file folders. In the most simple sense, it is an enclosure for drawers in which items are stored....
, which are the source of the term.

he lowest level, many modern operating systems consider files simply as a one-dimensional sequence of byte
Byte

A byte is a basic unit of measurement of Computer storage in computer science. In many computer architectures it is a Byte addressing memory address space....
s.






Discussion
Ask a question about 'Computer file'
Start a new discussion about 'Computer file'
Answer questions from other users
Full Discussion Forum



Encyclopedia


A computer file is a block of arbitrary information, or resource for storing information, which is available to a computer program
Computer program

Computer programs are Instruction for a computer. A computer requires programs to function. Moreover, a computer program does not run unless its instructions are executed by a Central processing unit; however, a program may communicate an Algorithm#Formalization of algorithms to people without running....
 and is usually based on some kind of durable storage
Computer storage

Computer data storage, often called storage or memory, refers to computer components, devices, and recording medium that retain digital data used for computing for some interval of time....
. A file is durable in the sense that it remains available for programs to use after the current program has finished. Computer files can be considered as the modern counterpart of paper document
Document

A document is a bounded physical representation of body of information designed with the capacity to communication. A document may manifest symbolic, diagrammatic or sensory-representational information....
s which traditionally were kept in offices' and libraries' files
Filing cabinet

A filing cabinet is a piece of office furniture usually used to store paper documents in file folders. In the most simple sense, it is an enclosure for drawers in which items are stored....
, which are the source of the term.

File contents

At the lowest level, many modern operating systems consider files simply as a one-dimensional sequence of byte
Byte

A byte is a basic unit of measurement of Computer storage in computer science. In many computer architectures it is a Byte addressing memory address space....
s. At a higher level, where the content of the file is being considered, these binary digits may represent integer
Integer

The integers are natural numbers including 0 and their negative and non-negative numberss . They are numbers that can be written without a fractional or decimal component, and fall within the set ....
 values, text character
Character (computing)

In computer and machine-based telecommunications terminology, a character is a unit of information that roughly corresponds to a grapheme, grapheme-like unit, or symbol, such as in an alphabet or syllabary in the written language form of a natural language....
s, image
Image

An image is an artifact, usually two-dimensional , that has a similar appearance to some subject —usually a physical object or a person....
 pixels, audio
Audio file format

An audio file format is a container format for storing Sound data on a computer system.The general approach towards storing digital audio is to sample the audio voltage which, on playback, would correspond to a certain position of the membrane in a speaker of the individual channels with a certain Audio bit depth ? the number of bits p...
 or anything else. It is up to the program using the file to understand the meaning and internal layout of information in the file and present it to a user as more meaningful information (like text, images, sounds, or executable application programs).

At any instant in time, a file might have a size, normally expressed as number of byte
Byte

A byte is a basic unit of measurement of Computer storage in computer science. In many computer architectures it is a Byte addressing memory address space....
s, that indicates how much storage is associated with the file. In most modern operating systems the size can be any non-negative whole number of bytes up to a system limit. However, the general definition of a file does not require that its instant size has any real meaning, unless the data within the file happens to correspond to data within a pool of persistent storage.

For example, the file to which the link /bin/ls points in a typical Unix-like
Unix-like

A Unix-like operating system is one that behaves in a manner similar to a Unix system, while not necessarily conforming to or being certified to any version of the Single UNIX Specification....
 system probably has a defined size that seldom changed. Compare this with /dev/null
/dev/null

In Unix-like operating systems, /dev/null or the null device is a special file that discards all data written to it , and provides no data to any process that reads from it ....
. This is a file, but its size may be open to question.

Information in a computer file can consist of smaller packets of information (often called "records
Row (database)

In the context of a relational database, a row?also called a record or tuple?represents a single, implicitly structured data item in a table ....
" 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. Alternatively, a file may contain an arbitrary binary image (a BLOB
Blob

Blob usually means a soft amorphous mass, and may refer to:* Binary large object , in computer database systems* Metaballs, in computer graphics terms, are organic-looking n-dimensional objects...
) or it may contain an executable
Executable

In computing, an executable causes a computer "to perform indicated tasks according to encoded instruction ," as opposed to a file that only contains data ....
.

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 imaginable 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 the user personally names. 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 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
Quake

Quake is a first-person shooter computer game that was released by id Software on June 22, 1996. It was the first game in the popular Quake of computer and video games....
 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
Microsoft Word

Microsoft Word is Microsoft's word processor computer software. It was first released in 1983 under the name Multi-Tool Word for Xenix systems....
 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
File manager

A file manager or file browser is a computer program that provides a user interface to work with file systems. The most common operations used are create, open, edit, file viewer, computer printer, streaming media, rename, move, file copying, file deletion, attributes, properties, search/find, and permissions....
 such as Windows Explorer
Windows Explorer

Windows Explorer is a file manager application that is included with releases of the Microsoft Windows operating system from Windows 95 onwards....
 (on Windows computers).

In Unix-like
Unix-like

A Unix-like operating system is one that behaves in a manner similar to a Unix system, while not necessarily conforming to or being certified to any version of the Single UNIX Specification....
 systems, user-space processes do not normally deal with files at all; the operating system
Operating system

An operating system is an interface between hardware and applications; it is responsible for the management and coordination of activities and the sharing of the limited resources of the computer....
 provides a level of abstraction
Abstraction

Abstraction is the process or result of generalization by reducing the information content of a concept or an observable phenomenon, typically in order to retain only information which is relevant for a particular purpose....
 which means that almost all interaction with files from user-space is through hard links. Hard links allow a name to be associated with a file (or they can be anonymous - and therefore temporary); files do not have names in the OS. For example, a user-space program cannot delete a file; it can delete a link to a file (for example, using the shell commands rm or mv or, in the anonymous case, simply by exiting), and if the kernel determines that there are no more existing links to the file, it may then delete the file. In fact, it really is only the kernel that deals with files, but it serves to handle all user-space interaction with (virtual) files in a manner that is transparent to the user-space programs.

Semantics

Although the way programs manipulate files varies according to the operating system and file system involved, the following operations are typical:
  • Creating a file with a given name
  • Setting attributes that control operations on the file
  • Opening a file to use its contents
  • Reading or updating the contents
  • Committing updated contents to durable storage
  • Closing the file, thereby losing access until it is opened again


Identifying and organizing files

In modern computer systems, files are typically accessed using names (filename
Filename

A filename is a special kind of String used to uniquely identify a computer file stored on the file system of a computer. Some operating systems also identify directory in the same way....
s). In some operating systems, the name is associated with the file itself. In others, the file is anonymous, and is pointed to by links that have names. In the latter case, a user can identify the name of the link with the file itself, but this is a false analogue, especially where there exists more than one link to the same file.

Files (or links to files) can be located in directories. However, more generally, a directory can contain either a list of files or a list of links to files. Within this definition, it is of paramount importance that the term "file" includes directories. This permits the existence of directory hierarchies, i.e., directories containing subdirectories. A name that refers to a file within a directory must be unique. In other words, there must be no identical names within a directory. However, in some operating systems, a name may include a specification of type that means a directory can contain an identical name for more than one type of object such as a directory and a file.

In environments in which a file is named, a file's name and the path to the file's directory must uniquely identify it among all other files in the computer system—no two files can have the same name and path. Where a file is anonymous, named references to it will exist within a namespace. In most cases, any name within the namespace will refer to exactly zero or one file. However, any file may be represented within any namespace by zero, one or more names.

Any string of characters may or may not be a well-formed name for a file or a link depending upon the context of application. Whether or not a name is well-formed 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 (some up to 255 characters) containing almost any combination of unicode
Unicode

Unicode is a computing industry standard allowing computers to consistently represent and manipulate Character expressed in most of the world's writing systems....
 letters or unicode 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
File system

In computing, a file system is a method for store and organize computer files and the data they contain to make it easy to find and access them....
. 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
Microsoft Windows

Microsoft Windows is a series of software operating systems and graphical user interfaces produced by Microsoft. Microsoft first introduced an operating environment named Windows in November 1985 as an add-on to MS-DOS in response to the growing interest in graphical user interfaces ....
 supports multiple file systems, each with different policies regarding case-sensitivity. The common FAT
File Allocation Table

File Allocation Table or FAT is a computer file system architecture now widely used on most computer systems and most memory cards, such as those used with digital cameras....
 file system can have multiple files whose names differ only in case if the user uses a disk editor
Disk editor

A disk editor is a computer program that allows its user to read, edit, and write raw data on disk drives ; as such, they are sometimes called sector editors, since the read/write routines built into the electronics of most disk drives require to read/write data in chunks of disk sectors ....
 to edit the file names in the directory entries
File Allocation Table

File Allocation Table or FAT is a computer file system architecture now widely used on most computer systems and most memory cards, such as those used with digital cameras....
. 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 using 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. These other folders are referred to as subfolders. Subfolders 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 operating system to another) can contain any number of levels of other folders and files. 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
Filename extension

A filename extension is a substring to the filename of a computer file applied to indicate the encoding convention of its contents.In some operating systems it is optional, while in some others it is a requirement....
 in file names to help identify what they contain, also known as the file type. On Windows computers, extensions consist of a dot (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; a .doc extension identifies any type of document or documentation, commonly in the Microsoft Word
Microsoft Word

Microsoft Word is Microsoft's word processor computer software. It was first released in 1983 under the name Multi-Tool Word for Xenix systems....
 file format
File format

A file format is a particular way to encode information for storage in a computer file.Since a disk drive, or indeed any computer storage, can store only bits, the computer must have some way of converting information to 0s and 1s and vice-versa....
; and so on
List of file formats

This is a list of file formats organized by type, as can be found on computers. Filename extensions are usually noted in parentheses if they differ from the format name or abbreviation....
. 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 should not alter.

Storing files

The discussion above describes a file as a concept presented to a user or a high-level operating system. However, any file that has any useful purpose, outside of a thought experiment, must have some physical manifestation. That is, a file (an abstract concept) in a real computer system must have a real physical analogue if it is to exist at all.

In physical terms, most computer files are stored on some type of data storage device. For example, there is a hard disk
Hard disk

A hard disk drive , commonly referred to as a hard drive, hard disk, or fixed disk drive, is a non-volatile storage device which stores digitally encoded data on rapidly rotating hard disk platters with magnetic surfaces....
, from which most operating system
Operating system

An operating system is an interface between hardware and applications; it is responsible for the management and coordination of activities and the sharing of the limited resources of the computer....
s run and on which most store their files. Hard discs are the most ubiquitous form of non-volatile storage at the start of the 21st century. Where files contain only temporary information, they may be stored in RAM
Ram

Ram, ram, or RAM as a non-acronymic wordAs a non-acronymic word Ram, ram, or RAM may refer to:...
.

In Unix-like operating systems, many files have no direct association with a physical storage device: /dev/null
/dev/null

In Unix-like operating systems, /dev/null or the null device is a special file that discards all data written to it , and provides no data to any process that reads from it ....
 is a prime example, as are just about all files under /dev, /proc and /sys. These can be accessed as files in user space. They are really virtual files that exist, in reality, as objects within the operating system kernel.

Computer files may be stored on magnetic tape. Files can also be stored on other media in some cases, such as writeable compact disc
Compact Disc

A Compact Disc is an optical disc used to store Data , originally developed for storing digital audio. The CD, available on the market since October 1982, remains the standard physical medium for sale of commercial Sound recording and reproduction to the present day....
s
, Digital Versatile Discs, Zip drive
Zip drive

The Zip drive is a medium-capacity removable disk storage system, introduced by Iomega in late 1994. Originally, Zip disks had a capacity of 100 megabyte, but later versions increased this to first 250 MB and then 750 MB....
s,
USB flash drive
USB flash drive

A USB flash drive consists of a Flash memory#NAND memories-type flash memory data storage device integrated with a USB interface. USB flash drives are typically removable and rewritable, much smaller than a floppy disk , and most USB flash drives weigh less than an ounce ....
s,
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 writable 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.

The grandfather-father-son backup
Grandfather-Father-Son Backup

Grandfather-father-son backup refers to the most common rotation scheme for rotating backup media. Originally designed for tape back up, it works well for any hierarchical backup strategy....
 method automatically makes three back ups, the grandfather file is the oldest copy of the file and the son is the current copy.

File systems and file managers

The way a computer organizes, names, stores and manipulates files is globally referred to as its file system
File system

In computing, a file system is a method for store and organize computer files and the data they contain to make it easy to find and access them....
.
Most computers have at least one file system. Some computers allow the use of several different file systems. For instance, on newer MS Windows computers, the older FAT-type file systems of MS-DOS
MS-DOS

MS-DOS is an operating system commercialized by Microsoft. It was the most commonly used member of the DOS family of operating systems and was the main operating system for personal computers during the 1980s....
 and old versions of Windows are supported, in addition to the NTFS
NTFS

NTFS is the standard file system of Windows NT, including its later versions Windows 2000, Windows XP, Windows Server 2003, Windows Server 2008, Windows Vista, and Windows 7....
 file system that is the normal file system for recent versions of Windows. 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
File manager

A file manager or file browser is a computer program that provides a user interface to work with file systems. The most common operations used are create, open, edit, file viewer, computer printer, streaming media, rename, move, file copying, file deletion, attributes, properties, search/find, and permissions....
 programs are utility programs that allow users 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.

History

Punchcarddecks
Brl61 Ibm 305 Ramac
The word "file" appears in the context of computer storage as early as 1952, referring to information stored on punched cards. In early usage people regarded the underlying hardware (rather than the contents) as a file. For example, the IBM 350 disk drives were called "disk files." Systems like the 1962 Compatible Time-Sharing System featured file systems, which gave the appearance of several "files" on one storage device, leading to the modern usage of the term. File names in CTSS had two parts, a user-readable "primary name" and a "secondary name" indicating the file type. This convention remains in use by several operating systems today, including Microsoft Windows
Microsoft Windows

Microsoft Windows is a series of software operating systems and graphical user interfaces produced by Microsoft. Microsoft first introduced an operating environment named Windows in November 1985 as an add-on to MS-DOS in response to the growing interest in graphical user interfaces ....
. Although the current term "register file
Register file

A register file is an array of processor registers in a central processing unit. Modern integrated circuit-based register files are usually implemented by way of fast static RAMs with multiple ports....
" shows the early concept of files, it has largely disappeared.

See also

  • Block (data storage)
    Block (data storage)

    In computing , a block is a sequence of bytes or bits, having a nominal length . Data thus structured is said to be blocked. The process of putting data into blocks is called blocking....
  • Computer file management
    Computer file management

    The term computer file management refers to the manipulation of [document]s and [data] in [Computer file|file]s on a [computer]].----...
  • File copying
    File copying

    File copying is creation of a new computer file which has the same content as an existing file.All operating systems include file copying in the user interface, like "cp " in Unix and "copy " in MS-DOS; operating systems with GUIs usually provide copy-and-paste or drag-and-drop methods of file copying.  File managers, too, provide an e...
  • File deletion
    File deletion

    File deletion is a way of removing a computer file from a computer's file system.The reasons for deleting files are#Freeing the disk space#Removing duplicate or unnecessary data to avoid confusion...
  • File directory
  • File manager
    File manager

    A file manager or file browser is a computer program that provides a user interface to work with file systems. The most common operations used are create, open, edit, file viewer, computer printer, streaming media, rename, move, file copying, file deletion, attributes, properties, search/find, and permissions....
  • File name
    Filename

    A filename is a special kind of String used to uniquely identify a computer file stored on the file system of a computer. Some operating systems also identify directory in the same way....
  • File size
    File size

    File size measures the size of a computer computer file. Typically it is measured in bytes with a prefix. The actual amount of Computer data storage consumed by the file depends on the file system....
  • File system
    File system

    In computing, a file system is a method for store and organize computer files and the data they contain to make it easy to find and access them....
  • Flat file
  • Soft copy
    Soft copy

    A soft copy is essentially the unprinted Computer file. It can usually be viewed through a word processing program. It can be transported from one computer to another through email....
  • Object composition
    Object composition

    In computer science, object composition is a way to Object association simple object s or data types into more complex ones. Compositions are a critical building block of many basic data structures, including the tagged union, the linked list, and the binary tree, as well as the object used in object-oriented programming....
  • File Camouflage
    File Camouflage

    File camouflage is a computer technique to hide secret information in a file.Most of the file formats have some redundant portions where any confidential data could be inserted intentionally....


External links and references