A zero byte file is a data file on a computer system, hard drive or other storage device that has an actual length of zero bytes. In many cases, a zero byte file is created because of an error — such as an interrupted network transfer, software crash or improperly written file handling routine — during the creation of a file. Other times, a zero byte file is created intentionally to send a message to a user viewing a file directory, to reserve a directory or filename to control automatic processes, or to indicate some immediate state or information to a program. There is a technical difference between a zero byte file whose file size is actually zero bytes and a file that contains no generated data, such as a document file with no textual content that still could contain metadata or other information from the program that created it. Occasionally, especially when a zero length file is created through an error, deleting a zero byte file can be very difficult because the corrupted file prevents the operating system from directly manipulating the file.
Within a file system for a computer or other device, files have certain attributes — such as their name, extension and access properties — that are maintained by the operating system. The information the file contains beyond that is stored as bytes and can be counted to determine the size of a file. Most files contain some information, because creating a file is not always a trivial task. It is possible, however, for a file to be created within an operating system so it has a name and attributes but contains no data, making it a zero byte file.
Creating and writing information to a file on a storage device is a process that takes multiple steps to complete. In some cases, this process can be interrupted or not completed, leaving a file that does not contain any data. One common cause of this involves caching, a procedure operating systems use to collect a large amount of data in random access memory (RAM) before activating the physical storage device to perform the more time-consuming task of physically encoding and storing the information. The cache for data is not always automatically written to a file — a function called flushing — so a file can be created and then the cache not flushed, so the data is never physically written and an empty file is left.
The same concept as flushing a cache during file creation can occur when data is being transmitted over a network, such as while downloading a file from the Internet. If the data transfer is not completed, then the information might never be written to the storage drive, leaving a zero byte file behind. Other causes for a zero length file include physical errors on a disk that prevent data from being written and corrupted file allocation table information that leaves zero length artifacts that are not really files.
A zero byte file sometimes can be created intentionally. This can be done to leave a message for a user by using the name of the file as opposed to storing information inside. They also are used as placeholders to indicate that a particular process, such as installation or registration, has been performed. A zero length file also sometimes can be made by a program that intends to write information but then receives nothing to write, leaving an empty file.