HOME

TheInfoList



OR:

A zero-byte file or zero-length file is a
computer file A computer file is a System resource, resource for recording Data (computing), data on a Computer data storage, computer storage device, primarily identified by its filename. Just as words can be written on paper, so too can data be written to a ...
containing no
data Data ( , ) are a collection of discrete or continuous values that convey information, describing the quantity, quality, fact, statistics, other basic units of meaning, or simply sequences of symbols that may be further interpreted for ...
; that is, it has a length or size of zero bytes.


Creation

There are many ways that could manually create a zero-byte file, for example, saving empty content in a
text editor A text editor is a type of computer program that edits plain text. An example of such program is "notepad" software (e.g. Windows Notepad). Text editors are provided with operating systems and software development packages, and can be used to c ...
, using
utilities A public utility company (usually just utility) is an organization that maintains the infrastructure for a public service (often also providing a service using that infrastructure). Public utilities are subject to forms of public control and r ...
provided by
operating systems An operating system (OS) is system software that manages computer hardware and software resources, and provides common daemon (computing), services for computer programs. Time-sharing operating systems scheduler (computing), schedule tasks for ...
, or programming to create it. On
Unix-like A Unix-like (sometimes referred to as UN*X, *nix or *NIX) operating system is one that behaves in a manner similar to a Unix system, although not necessarily conforming to or being certified to any version of the Single UNIX Specification. A Uni ...
systems, the shell command $
touch The somatosensory system, or somatic sensory system is a subset of the sensory nervous system. The main functions of the somatosensory system are the perception of external stimuli, the perception of internal stimuli, and the regulation of bo ...
filename
results in a zero-byte file . Zero-byte files may arise in cases where a program creates a file but aborts or is interrupted prematurely while writing to it. Because writes are cached in
memory Memory is the faculty of the mind by which data or information is encoded, stored, and retrieved when needed. It is the retention of information over time for the purpose of influencing future action. If past events could not be remembe ...
and only flushed to disk at a later time (
page cache In computing, a page cache, sometimes also called disk cache, is a transparent cache for the pages originating from a secondary storage device such as a hard disk drive (HDD) or a solid-state drive (SSD). The operating system keeps a page ca ...
), a program that does not flush its writes to disk or terminate normally may result in a zero-byte file. When the zero-byte file is made, the file system does not record the file's content on storage, but only updates its metadata.


Metadata

Even a file describing an empty
word processor A word processor (WP) is a device or computer program that provides for input, editing, formatting, and output of text, often with some additional features. Early word processors were stand-alone devices dedicated to the function, but current word ...
document A document is a writing, written, drawing, drawn, presented, or memorialized representation of thought, often the manifestation of nonfiction, non-fictional, as well as fictional, content. The word originates from the Latin ', which denotes ...
, an
image file An image file format is a file format for a digital image. There are many formats that can be used, such as JPEG, PNG, and GIF. Most formats up until 2022 were for storing 2D images, not 3D ones. The data stored in an image file format may be c ...
with zero-by-zero dimensions, or an audio file of length zero seconds usually still contains
metadata Metadata (or metainformation) is "data that provides information about other data", but not the content of the data itself, such as the text of a message or the image itself. There are many distinct types of metadata, including: * Descriptive ...
identifying the
file format A file format is a Computer standard, standard way that information is encoded for storage in a computer file. It specifies how bits are used to encode information in a digital storage medium. File formats may be either proprietary format, pr ...
and describing some basic attributes of the file; it results in the file with some positive size. Some very simple formats do not use metadata, such as
ASCII ASCII ( ), an acronym for American Standard Code for Information Interchange, is a character encoding standard for representing a particular set of 95 (English language focused) printable character, printable and 33 control character, control c ...
text file A text file (sometimes spelled textfile; an old alternative name is flat file) is a kind of computer file that is structured as a sequence of lines of electronic text. A text file exists stored as data within a computer file system. In ope ...
s; these may validly be zero bytes (a common convention terminates text files with a one- or two-byte newline, however). An empty file has a minimum disk size that depends on the disk block size, which can also be referred to as cluster size or IO block size, that depends in turn on the filesystem. This IO block size can be discovered through different utilities in the
operating system An operating system (OS) is system software that manages computer hardware and software resources, and provides common daemon (computing), services for computer programs. Time-sharing operating systems scheduler (computing), schedule tasks for ...
, such as '' stat'' in Unix systems. Typically 4096 bytes.


Uses

Zero-byte files cannot be loaded or used by most applications. In some cases, zero-byte files may be used to convey information like file metadata (for example, its
filename A filename or file name is a name used to uniquely identify a computer file in a file system. Different file systems impose different restrictions on filename lengths. A filename may (depending on the file system) include: * name – base ...
may contain an instruction to a user viewing a directory listing such as , etc.); or to put in a directory to ensure that it is non-empty, since some tools such as backup and
revision control Version control (also known as revision control, source control, and source code management) is the software engineering practice of controlling, organizing, and tracking different versions in history of computer files; primarily source code ...
software may ignore the empty directories. IF Exist - Testing: Use the zero-byte (zero length) file as an "exit" ramp or for a "goto" statement within a batch-file or script. It provides a directory listing, but requires no disk space. IF EXIST C:\NOTHING.TXT EXIT IF NOT EXIST C:\NOTHING.TXT GOTO START :START REM Create the zero-length file C:\>type null>nothing.txt :EXIT


References


Bibliography

* Computer files {{software-type-stub