Jump to content
 







Main menu
   


Navigation  



Main page
Contents
Current events
Random article
About Wikipedia
Contact us
Donate
 




Contribute  



Help
Learn to edit
Community portal
Recent changes
Upload file
 








Search  

































Create account

Log in
 









Create account
 Log in
 




Pages for logged out editors learn more  



Contributions
Talk
 



















Contents

   



(Top)
 


1 Creation  



1.1  Metadata  







2 Uses  





3 References  





4 Bibliography  














Zero-byte file






العربية

 

Edit links
 









Article
Talk
 

















Read
Edit
View history
 








Tools
   


Actions  



Read
Edit
View history
 




General  



What links here
Related changes
Upload file
Special pages
Permanent link
Page information
Cite this page
Get shortened URL
Download QR code
Wikidata item
 




Print/export  



Download as PDF
Printable version
 
















Appearance
   

 






From Wikipedia, the free encyclopedia
 


Azero-byte fileorzero-length file is a computer file containing no data; that is, it has a length or size of zero bytes.[1]

Creation[edit]

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 cachedinmemory 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[edit]

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 statinUnix systems.[2][3]

Uses[edit]

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[edit]

  • ^ 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[edit]


  • t
  • e

  • Retrieved from "https://en.wikipedia.org/w/index.php?title=Zero-byte_file&oldid=1215622282"

    Categories: 
    Computer files
    Software type stubs
    Hidden categories: 
    Articles with short description
    Short description matches Wikidata
    Articles needing additional references from July 2021
    All articles needing additional references
    Articles with topics of unclear notability from April 2023
    All articles with topics of unclear notability
    Articles with multiple maintenance issues
    All stub articles
     



    This page was last edited on 26 March 2024, at 05:41 (UTC).

    Text is available under the Creative Commons Attribution-ShareAlike License 4.0; additional terms may apply. By using this site, you agree to the Terms of Use and Privacy Policy. Wikipedia® is a registered trademark of the Wikimedia Foundation, Inc., a non-profit organization.



    Privacy policy

    About Wikipedia

    Disclaimers

    Contact Wikipedia

    Code of Conduct

    Developers

    Statistics

    Cookie statement

    Mobile view



    Wikimedia Foundation
    Powered by MediaWiki