Computer file
This article needs additional citations for verification. (June 2009) |
In
Different types of computer files are designed for different purposes. A file may be designed to store an image, a written message, 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.
Files are typically organized in a file system, which tracks file locations on the disk and enables user access.
Etymology
The word "file" derives from the Latin filum ("a thread, string").[1]
"File" was used in the context of computer storage as early as January 1940. In Punched Card Methods in Scientific Computation,[2] W. J. Eckert stated, "The first extensive use of the early Hollerith Tabulator in astronomy was made by Comrie.[3] 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
In 1952, "file" denoted, among other things, information stored on punched cards.[5]
In early use, the underlying hardware, rather than the contents stored on it, was denominated a "file". For example, the
File contents
On most modern operating systems, files are organized into one-dimensional arrays of bytes. The format of a file is defined by its content since a file is solely a container for data.
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.
Some file systems can store arbitrary (not interpreted by the file system) file-specific data outside of the file format, but linked to the file, for example
File size
This section may have misleading content.(March 2019) |
At any instant in time, a file has a specific size, normally expressed as a number of
The general definition of a file does not require that its size have any real meaning, however, unless the data within the file happens to correspond to data within a pool of persistent storage. A special case is a
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.
Operations
The most basic operations that programs can perform on a file are:
- Create a new file
- Change the access permissions and attributesof 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
Files on a computer can be created, moved, modified, grown, shrunk (
In
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
There are two distinct implementations of file moves.
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.
With the
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
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
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
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
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
In Unix-like operating systems, many files have no associated physical storage device. Examples are
As seen by a running user program, files are usually represented either by a
File corruption
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.[8] 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.[9] 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.[10] 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;[8][9][10]
- A download being interrupted before it was completed;
- Due to a bad sector on the hard drive;[8][9]
- The user removing a flash drive (such as a USB stick) without properly unmounting (commonly referred to as "safely removing");[11][12][13][14]
- Malicious software, such as a computer virus;[8][9][15][16]
- A flash drive becoming too old.[14]
Although file corruption usually happens accidentally, it may also be done on purpose as a mean of procrastination, as to fool someone else into thinking an assignment was ready at an earlier date, potentially gaining time to finish said assignment or making experiments, with the purpose of documenting the consequences when such file is corrupted. 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.[17][18]
One of the most effective countermeasures for unintentional file corruption is backing up important files.[19] In the event of an important file becoming corrupted, the user can simply replace it with the backed up version.
Backup
When computer files contain information that is extremely important, a
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
File systems and file managers
The way a computer organizes, names, stores and manipulates files is globally referred to as its file system. 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 and old versions of Windows are supported, in addition to the NTFS file system that is the normal file system for recent versions of Windows. Each system has its own advantages and disadvantages. Standard FAT allows 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 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. For example, File Explorer (formerly Windows Explorer) is commonly used in Microsoft Windows operating systems, and Nautilus is common under several distributions of Linux.
See also
- Block (data storage)
- Computer file management
- Data hierarchy
- File camouflage
- File copying
- File conversion
- File deletion
- File directory
- File manager
- File system
- Filename
- Flat-file database
- Object composition
- Soft copy
Notes
- ^ Can also be shown as kilobytes, megabytes, gigabytes, etc.
References
- ^ "Online Etymology Dictionary". Archived from the original on 2015-09-24. Retrieved 2015-08-17.
- ^ 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. Archived from the original on 2020-06-12. Retrieved 2018-04-17.
- ISSN 0035-8711.
- ^ Popular Science. Bonnier Corporation. February 1950. p. 96. Archived from the original on 2022-01-09. Retrieved 2014-03-07.
- ^ Robert S. Casey, et al. Punched Cards: Their Applications to Science and Industry. 1952.
- ^ Martin H. Weik. Ballistic Research Laboratories Report #1115. March 1961. pp. 314–331 Archived 2016-10-21 at the Wayback Machine.
- ^ Magnetic Storage Handbook 2nd Ed., Section 2.1.1, Disk File Technology, Mee and Daniel, (c)1990,
- ^ a b c d Gorski, Victoria. "What Causes a Corrupt File?". Archived from the original on 2020-07-28. Retrieved 2019-03-17.
- ^ a b c d Williams, Jane (2019-01-14). "What Does It Mean When Your File Is Corrupt?". Houston Chronicle. Archived from the original on 2019-07-15. Retrieved 2019-03-17.
- ^ a b Glenn, Walter (2017-12-14). "What Is a Corrupted File, and Is There a Way to Get It Back?". How-To Geek. Archived from the original on 2018-12-06. Retrieved 2019-03-17.
- ^ "What Causes Flash Memory Corruption?". SecureDataRecovery. Archived from the original on 2020-07-28. Retrieved 2019-03-17.
- ^ Hoffman, Chris (2016-09-28). "Do You Really Need to Safely Remove USB Flash Drives?". How-To Geek. Archived from the original on 2019-03-30. Retrieved 2019-03-17.
- ^ "Open a document after a file corruption error". Microsoft Office Support. Archived from the original on 2019-08-28. Retrieved 2019-03-17.
- ^ a b "What kills your Flash Drive and how you can avoid it". DataRecovery.net. Archived from the original on 2018-09-06. Retrieved 2019-03-17.
- ^ Neagoe, Robert (2018-08-14). "Fix Windows 10 File Corruption Issues". Windowsreport.com. Archived from the original on 2020-07-28. Retrieved 2019-03-17.
- ISBN 978-1-4354-8364-4. Archivedfrom the original on 2020-07-29. Retrieved 2019-03-17.
- ^ "Corrupt a file - Corrupt file online, deliver on time!". Archived from the original on 2019-03-23. Retrieved 2019-03-17.
- ^ "Corrupt My File: Get your file corrupted for you". Archived from the original on 2019-03-15. Retrieved 2019-03-17.
- ^ "What is a Corrupted File?". Intego. 2019-03-07. Archived from the original on 2020-07-28. Retrieved 2019-03-17.
External links
- Media related to Computer files at Wikimedia Commons
- Data Formats Computer file at Curlie