Computer file

Short description: Computer resource for recording data on a storage device

A computer file is a named collection of data treated as a unit by the system that manages it. Today, this system is called a file system. Many older computer systems lacked a distinct file system per se, yet a management feature is required in order to provide a file abstraction.

Files can be shared with and transferred between computers and mobile devices via removable media, networks, or the Internet.

Different types of computer files are designed for different purposes. A file may be designed to store a written message, a document, a spreadsheet, an image, a video, a program, or any wide variety of other kinds of data. Certain files can store multiple data types at once.

By using computer programs, a person can open, read, change, save, and close a computer file. Computer files may be reopened, modified, and copied an arbitrary number of times.

## Contents

* 1 Etymology
* 2 File system
* 3 File manager
* 4 File contents
* 4.1 File size
* 4.2 Organization of data in a file
* 5 File operations
* 5.1 Moving methods
* 6 Identifying and organizing
* 7 Protection
* 8 Storage
* 9 File corruption
* 10 Backup
* 11 See also
* 12 References
* 13 External links

## Etymology

A punched-card file The twin disk files of an IBM 305 system

The word "file" derives from the Latin filum ("a thread, string").[1] In extended use the English term "file" came to refer to various systems of arranging papers and documents for retrieval.[2]

"File" was used in the context of computer storage as early as January 1940. In Punched Card Methods in Scientific Computation,[3] W. J. Eckert stated, "The first extensive use of the early Hollerith Tabulator in astronomy was made by Comrie.[4] He used it for building a table from successive differences, and for adding large numbers of harmonic terms". "Tables of functions are constructed from their differences with great efficiency, either as printed tables or as a file of punched cards."

In February 1950, in a Radio Corporation of America (RCA) advertisement in Popular Science magazine[5] describing a new "memory" vacuum tube it had developed, RCA stated: "the results of countless computations can be kept 'on file' and taken out again. Such a 'file' now exists in a 'memory' tube developed at RCA Laboratories. Electronically it retains figures fed into calculating machines, holds them in storage while it memorizes new ones – speeds intelligent solutions through mazes of mathematics."

In 1952, "file" denoted, among other things, information stored on punched cards.[6]

In early computing usage, the word "file" could refer to the underlying hardware, rather than to the contents stored on it. For example, the IBM 350 disk drives were denominated "disk files".[7] The introduction, c. 1961, by the Burroughs MCP and the MIT Compatible Time-Sharing System of the concept of a "file system" that managed several virtual "files" on one storage device is the origin of the contemporary denotation of the word. Although the contemporary "register file" demonstrates the early concept of files, its use has greatly decreased.

## File system

A file system provides the file abstraction to consuming software—it enables software to organize, name, and manipulate data as files. Although early computers did not contain a distinct file system, the function of what we call file system today is required as was often provided directly by the core operating system.

Not only do modern computer systems include a file system, some systems use multiple. Unix-like systems typically allow for using multiple file systems. On some Windows systems, the older FAT-type file systems of MS-DOS and old versions of Windows are supported, in addition to the NTFS file system that is the normal file system.

## File manager

A file manager is a utility that allows a user to manipulate files directly. Typically, it allows one to move, create, delete and rename files and directories (a.k.a. folders), although it may not directly support viewing file content. Typically, a computer system has at least one file manager program for its native file system. For example, File Explorer is commonly used in Windows, and Nautilus is in several Linux distributions.

## File contents

On some platforms the format is indicated by its filename extension, specifying the rules for how the bytes must be organized and interpreted meaningfully. For example, the bytes of a plain text file (.txt in Windows) are associated with either ASCII or UTF-8 characters, while the bytes of image, video, and audio files are interpreted otherwise. Most file types also allocate a few bytes for metadata, which allows a file to carry some basic information about itself.

### File size

This section may contain misleading parts. Please help clarify this article according to any suggestions provided on the talk page. (March 2019)

|

File size is a measure of the storage space allocated to the file. Although often expressed in units of bytes, many older file systems tracked size in larger units such as blocks or tracks. None-the-less, sometimes a more precise measure was available. For example, CP/M marked the end of a text file with Ctrl-Z which could be used to obtain a size with byte precision.

Typically, due to its design, a file system limits maximum file size.

### Organization of data in a file

Information in a computer file can consist of smaller packets of information (often called "records" or "lines") that are individually different but share some common traits. 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) or it may contain an executable.

The way information is grouped into a file is entirely up to how it is designed. 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 which create, modify or delete the 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. Although the content of the document file is arranged in a format that the word-processing program understands, the user is able to choose the name and location of the file and provide 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 called an archive file, using internal markers to discern the different types of information contained within. The benefits of the archive file are to lower the number of files for easier transfer, to reduce storage usage, or just to organize outdated files. The archive file must often be unpacked before next using.

## File operations

The most basic operations that programs can perform on a file are:

* Create a new file
* Change the access permissions and attributes of a file
* Open a file, which makes the file contents available to the program
* Read data from a file
* Write data to a file
* Delete a file
* Close a file, terminating the association between it and the program
* Truncate a file, shortening it to a specified size within the file system without rewriting any content
* Allocate space to a file without writing any content. Not supported by some file systems.[8]

Files on a computer can be created, moved, modified, grown, shrunk (truncated), 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) or by command lines (CLI).

In Unix-like systems, user space programs do not operate directly, at a low level, on a file. Only the kernel deals with files, and it handles all user-space interaction with files in a manner that is transparent to the user-space programs. The operating system provides a level of abstraction, which means that interaction with a file from user-space is simply through its filename (instead of its inode). For example, `rm filename` will not delete the file itself, but only a link to the file. There can be many links to a file, but when they are all removed, the kernel considers that file's memory space free to be reallocated. This free space is commonly considered a security risk (due to the existence of file recovery software). Any secure-deletion program uses kernel-space (system) functions to wipe the file's data.

File moves within a file system complete almost immediately because the data content does not need to be rewritten. Only the paths need to be changed.

### Moving methods

When moving files between devices or partitions, some file managing software deletes each selected file from the source directory individually after being transferred, while other software deletes all files at once only after every file has been transferred.

For example, the `mv` command uses the former method when moving files individually with wildcards (example: `mv -n sourcePath/* targetPath`), but uses the latter method when moving entire directories (example: `mv -n sourcePath targetPath`).

Microsoft Windows Explorer also varies its approach: it uses the former method for mass storage file moves, but uses the latter method when transferring files via Media Transfer Protocol, as described in Media Transfer Protocol § File move behavior.

The former method (individual deletion from source) has the benefit that space is released from the source device or partition imminently after the transfer has begun, meaning after the first file is finished. With the latter method, space is only freed after the transfer of the entire selection has finished.

If an incomplete file transfer with the latter method is aborted unexpectedly, perhaps due to an unexpected power-off, system halt or disconnection of a device, no space will have been freed up on the source device or partition. The user would need to merge the remaining files from the source, including the incompletely written (truncated) last file.

With the individual deletion method, the file moving software also does not need to cumulatively keep track of all files finished transferring for the case that a user manually aborts the file transfer. A file manager using the latter (afterwards deletion) method will have to only delete the files from the source directory that have already finished transferring.

## Identifying and organizing

Files and folders arranged in a hierarchy

In modern computer systems, files are typically accessed using names (filenames). 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 sub-directories. A name that refers to a file within a directory must be typically 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 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 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. 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[which?] 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 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 folder 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 computer systems use extensions 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 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 presented.

## Protection

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. For example, a given user may be granted only permission to read a file or folder, but not to modify or delete it; alternatively, a user may be given permission to read and modify files or folders, but not to execute 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 from unauthorized users.

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.

## Storage

Any file that has any useful purpose 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, most operating systems store files on a hard disk. Hard disks have been the ubiquitous form of non-volatile storage since the early 1960s.[9] Where files contain only temporary information, they may be stored in RAM. Computer files can be also stored on other media in some cases, such as magnetic tapes, compact discs, Digital Versatile Discs, Zip drives, USB flash drives, etc. The use of solid state drives is also beginning to rival the hard disk drive.

In Unix-like operating systems, many files have no associated physical storage device. Examples are /dev/null and most files under directories /dev, /proc and /sys. These are virtual files: they exist as objects within the operating system kernel.

As seen by a running user program, files are usually represented either by a file control block or by a file handle. A file control block (FCB) is an area of memory which is manipulated to establish a filename etc. and then passed to the operating system as a parameter; it was used by older IBM operating systems and early PC operating systems including CP/M and early versions of MS-DOS. A file handle is generally either an opaque data type or an integer; it was introduced in around 1961 by the ALGOL-based Burroughs MCP running on the Burroughs B5000 but is now ubiquitous.

## File corruption

Original JPEG file

Corrupted JPEG file, with a single bit flipped (turned from 0 to 1, or vice versa)

While there is visible corruption on the second file, one can still make out what the original image might have looked like.

When a file is said to be corrupted, it is because its contents have been saved to the computer in such a way that they cannot be properly read, either by a human or by software. Depending on the extent of the damage, the original file can sometimes be recovered, or at least partially understood.[10] A file may be created corrupt, or it may be corrupted at a later point through overwriting.

There are many ways by which a file can become corrupted. Most commonly, the issue happens in the process of writing the file to a disk.[11] For example, if an image-editing program unexpectedly crashes while saving an image, that file may be corrupted because the program could not save its entirety. The program itself might warn the user that there was an error, allowing for another attempt at saving the file.[12] Some other examples of reasons for which files become corrupted include:

* The computer itself shutting down unexpectedly (for example, due to a power loss) with open files, or files in the process of being saved;[10][11][12]
* A download being interrupted before it was completed;
* Due to a bad sector on the hard drive;[10][11]
* The user removing a flash drive (such as a USB stick) without properly unmounting (commonly referred to as "safely removing");[13][14][15][16]
* Malicious software, such as a computer virus;[10][11][17][18]
* A flash drive becoming too old.[16]

File corruption is typically unintentional; however, it may be done intentionally as an act of deception so that a student or employee can receive an extension on their deadline. There are services that provide on demand file corruption, which essentially fill a given file with random data so that it cannot be opened or read yet still seems legitimate.[19][20]

One of the most effective countermeasures for unintentional file corruption is backing up important files.[21] In the event of an important file becoming corrupted, the user can simply replace it with the backed up version.

## Backup

Main article: Backup

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 method automatically makes three back-ups; the grandfather file is the oldest copy of the file and the son is the current copy.

## See also

* Block (data storage)
* Character special file
* Computer file management
* Data hierarchy
* Everything is a file
* File camouflage
* File copying
* File conversion
* File deletion
* File directory
* File manager
* File system
* Filename
* Flat-file database
* Object composition
* Soft copy
* Unix file type
* Zero byte file

## References

1. ↑ "Online Etymology Dictionary". https://www.etymonline.com/index.php?term=file.
2. ↑ file (3rd ed.), Oxford University Press, September 2005, http://oed.com/search?searchType=dictionary&q=file (Subscription or UK public library membership required.) Recorded from 1525: "A string or wire, on which papers and documents are strung for preservation and reference. Later extended to various other appliances for holding papers so that they can be easily referred to."
3. ↑ Eckert, W. J.; Thomas J. Watson Astronomical Computing Bureau, New York (1940). Punched card methods in scientific computation. New York: The Thomas J. Watson Astronomical Computing Bureau, Columbia University. https://catalog.hathitrust.org/Record/002523225. Retrieved 2018-04-17.
4. ↑ Comrie, L. J. (1928-04-13). "On the Construction of Tables by Interpolation (Plate 6)" (in en). Monthly Notices of the Royal Astronomical Society 88 (6): 506–523. doi:10.1093/mnras/88.6.506. ISSN 0035-8711. Bibcode: 1928MNRAS..88..506C.
5. ↑ Popular Science, Bonnier Corporation, February 1950, p. 96, https://books.google.com/books?id=9SwDAAAAMBAJ&pg=PA96, retrieved 2014-03-07
6. ↑ Robert S. Casey, et al. Punched Cards: Their Applications to Science and Industry. 1952.
7. ↑ Martin H. Weik. Ballistic Research Laboratories Report #1115. March 1961. pp. 314–331 .
8. ↑ fallocate(1)
9. ↑ Magnetic Storage Handbook 2nd Ed., Section 2.1.1, Disk File Technology, Mee and Daniel, (c)1990,
10. ↑ 10.0 10.1 10.2 10.3 Gorski, Victoria. "What Causes a Corrupt File?". https://www.techwalla.com/articles/what-causes-a-corrupt-file.
11. ↑ 11.0 11.1 11.2 11.3 Williams, Jane (2019-01-14). "What Does It Mean When Your File Is Corrupt?". Houston Chronicle. https://smallbusiness.chron.com/mean-file-corrupt-70768.html.
12. ↑ 12.0 12.1 Glenn, Walter (2017-12-14). "What Is a Corrupted File, and Is There a Way to Get It Back?". How-To Geek. https://www.howtogeek.com/336099/what-is-a-corrupted-file-and-is-there-a-way-to-get-it-back/.
13. ↑ "What Causes Flash Memory Corruption?". SecureDataRecovery. https://www.securedatarecovery.com/services/hard-drive-recovery/what-causes-flash-media-corruption.
14. ↑ Hoffman, Chris (2016-09-28). "Do You Really Need to Safely Remove USB Flash Drives?". How-To Geek. https://www.howtogeek.com/118546/htg-explains-do-you-really-need-to-safely-remove-usb-sticks/.
15. ↑ "Open a document after a file corruption error". Microsoft Office Support. https://support.office.com/en-us/article/open-a-document-after-a-file-corruption-error-47df9d48-2165-4411-a699-1786ac734bc3.
16. ↑ 16.0 16.1 "What kills your Flash Drive and how you can avoid it". DataRecovery.net. https://www.datarecovery.net/newsletters/what-kills-flash-drive.aspx.
17. ↑ Neagoe, Robert (2018-08-14). "Fix Windows 10 File Corruption Issues". Windowsreport.com. https://windowsreport.com/fix-windows-10-file-corruption-issues/.
18. ↑ International Council of Electronic Commerce Consultants (2009-09-24). "Mac OS X Hacking" (in en). Ethical Hacking and Countermeasures: Linux, Macintosh and Mobile Systems. Cengage. pp. 2.6–2.7. ISBN 978-1-4354-8364-4. https://books.google.com/books?id=LYFoU2HG_AkC&pg=SA2-PA6. Retrieved 2019-03-17.
19. ↑ "Corrupt a file - Corrupt file online, deliver on time!". https://corrupt-a-file.net/.
20. ↑ "Corrupt My File: Get your file corrupted for you". https://www.corruptmyfile.com/.
21. ↑ "What is a Corrupted File?". Intego. 2019-03-07. https://support.intego.com/hc/en-us/articles/207114508-What-is-a-Corrupted-File-.

## External links

* v
* t
* e

Computer files

Types|

* Binary file / text file
* File format
* List of file formats
* File signatures
* Magic number
* Metafile
* Sidecar file
* Sparse file
* Swap file
* System file
* Temporary file
* Zero-byte file

Properties|

* Filename
* 8.3 filename
* Long filename
* Filename mangling
* Filename extension
* List of filename extensions
* File attribute
* Extended file attributes
* File size
* Hidden file / Hidden directory

Organisation|

* Directory/folder
* NTFS junction point
* Temporary folder
* Directory structure
* File sequence
* File system
* Filesystem Hierarchy Standard
* Path

Operations|

* Open
* Close
* Read
* Write

Linking|

* Alias
* File descriptor
* Hard link
* Shadow
* Shortcut
* Symbolic link

Management|

* File comparison
* File compression
* File manager
* Comparison of file managers
* File system permissions
* File transfer
* File sharing
* File verification

0.00

(0 votes)

Original source: https://en.wikipedia.org/wiki/Computer file. Read more

|

Retrieved from "https://handwiki.org/wiki/index.php?title=Computer_file&oldid=4297808"
*[c.]: circa
*[v]: View this template
*[t]: Discuss this template
*[e]: Edit this template