Zero-byte file: Difference between revisions
→Metadata: more info Tags: Visual edit Disambiguation links added |
|||
Line 11: | Line 11: | ||
Even a file describing an empty [[word processor]] [[document]], an [[image file]] with zero-by-zero dimensions, or an [[audio file]] of length zero seconds usually still contains [[metadata]] identifying the [[file format]] 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]] [[text file]]s; these may validly be zero bytes (a common convention terminates text files with a one- or two-byte newline, however). |
Even a file describing an empty [[word processor]] [[document]], an [[image file]] with zero-by-zero dimensions, or an [[audio file]] of length zero seconds usually still contains [[metadata]] identifying the [[file format]] 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]] [[text file]]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]], such as ''[[stat]]'' in Unix systems.<ref>{{Cite web |last=Team |first=Tech Insight |date=2020-08-07 |title=Size vs Size on Disk - Why is there a difference? |url=https://www.businesstechweekly.com/tech-insights/size-vs-size-on-disk/ |access-date=2023-09-27 |website=Businesstechweekly.com |language=en-GB}}</ref><ref>{{Cite web |title=Understanding IO Block size |url=https://unix.stackexchange.com/questions/345984/understanding-io-block-size |access-date=2023-09-27 |website=Unix & Linux Stack Exchange |language=en}}</ref> |
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]], such as ''[[Stat (system call)|stat]]'' in [[Unix|Unix systems]].<ref>{{Cite web |last=Team |first=Tech Insight |date=2020-08-07 |title=Size vs Size on Disk - Why is there a difference? |url=https://www.businesstechweekly.com/tech-insights/size-vs-size-on-disk/ |access-date=2023-09-27 |website=Businesstechweekly.com |language=en-GB}}</ref><ref>{{Cite web |title=Understanding IO Block size |url=https://unix.stackexchange.com/questions/345984/understanding-io-block-size |access-date=2023-09-27 |website=Unix & Linux Stack Exchange |language=en}}</ref> |
||
== Uses == |
== 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]] may contain an instruction to a user viewing a directory listing such as {{mono|documents-have-been-moved-to-partition-D}}, etc.); or to put in a directory to ensure that it is non-empty, since some tools such as backup and [[revision control]] software may ignore the empty directories. |
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]] may contain an instruction to a user viewing a directory listing such as {{mono|documents-have-been-moved-to-partition-D}}, etc.); or to put in a directory to ensure that it is non-empty, since some tools such as backup and [[revision control]] software may ignore the empty directories. |
Revision as of 11:16, 27 September 2023
![]() | This article has multiple issues. Please help improve it or discuss these issues on the talk page. (Learn how and when to remove these template messages)
|
A zero-byte file or zero-length file is a computer file containing no data; that is, it has a length or size of zero bytes.[2]
Creation
There are many ways that could manually create a zero-byte file, for example, saving empty content in a text editor, using utilities provided by operating systems, or programming to create it. On Unix-like systems, the shell command $ touch filename
results in a zero-byte file filename. 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 and only flushed to disk at a later time (page cache), 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, file system does not record the file's content on storage, but only updates its index table.
Metadata
Even a file describing an empty word processor document, an image file with zero-by-zero dimensions, or an audio file of length zero seconds usually still contains metadata identifying the file format 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 text files; 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, such as stat in Unix systems.[3][4]
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 may contain an instruction to a user viewing a directory listing such as documents-have-been-moved-to-partition-D, etc.); or to put in a directory to ensure that it is non-empty, since some tools such as backup and revision control 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
- ^ Team, Tech Insight (2020-08-07). "Size vs Size on Disk - Why is there a difference?". Businesstechweekly.com. Retrieved 2023-09-27.
- ^ Mathai (2019).
- ^ Team, Tech Insight (2020-08-07). "Size vs Size on Disk - Why is there a difference?". Businesstechweekly.com. Retrieved 2023-09-27.
- ^ "Understanding IO Block size". Unix & Linux Stack Exchange. Retrieved 2023-09-27.
Bibliography
- Mathai, Anith (2019). "Zero-byte files. A big problem in eDiscovery. What are they, and is there anything you can do about them?". www.linkedin.com.