Sometimes we need one, a few, or a lot of empty dummy files – just for testing our application, or to hold a space.
Now you could open a text editor and save an empty file, but there are easier ways to make empty dummy files.
In this article I’ll show you how it can be done under Windows (incl. DOS and PowerShell), Linux and macOS.
Empty dummy files
Let’s be clear from the start that the files we are going to create here are truly empty. Empty as in zero bytes. Totally empty.
Warning – These will be Totally Empty Dummy files!
Since these empty files have zero content, certain additional data that certain applications expect in a file, will not be there either.
For example:
Quite a few application (for example Microsoft Word, Microsoft Excel, Adobe Photoshop, Adobe PDF, etc.) store additional data/information in their files, quite often not visible to the regular user. Ever wondered why a tiny text in Word can takes several Kilobytes (or even worse) in a .doc or .docx file?
The files that we create here will not have this additional information included. It’s really totally empty!
This means that these empty dummy files will may trigger an error message when trying to open it with one of these applications.
Simple applications like Notepad do not store extra data, and therefor will not show an error.
Below you’ll find the tricks for Linux like systems (Linux, FreeBSD, Unix and macOS) and Microsoft Windows (MSDos and PowerShell).
Ad Blocking Detected Please consider disabling your ad blocker for our website.
We rely on these ads to be able to run our website.
You can of course support us in other ways (see Support Us on the left).
Linux (and most Linux variants)
Linux (and most Linux like variants) have a shell command called “touch“. To create an empty file, simply use that.
To get into the shell, from a graphical user interface, you can quite often use an application called “Shell” or “Terminal“.
Ubuntu calls it Terminal others may call it “Shell” or “Command-line”.
The example below creates the empty file example.txt:
MacOS X
Since macOS has roots in FreeBSD, it should not come as a surprise that the Linux trick works here as well.
You’ll find “Terminal” under “Application” – “Utilities“.
The example below creates the empty file example.txt:
Ad Blocking Detected Please consider disabling your ad blocker for our website.
We rely on these ads to be able to run our website.
You can of course support us in other ways (see Support Us on the left).
Windows Desktop
From within Windows, right-click in the area where you want to create the file.
For example, right-click on the Desktop to create a new text file on the Desktop. In the drop-down menu that appears, select “New” and choose “Text Document“.
Windows – Create New Document
Since Windows provides access to MS-DOS, and newer Windows version also provide access to PowerShell, consider the following options as well.
Windows MS-DOS (Command or Cmd)
Here 3 examples of how this can be done in MS-DOS (or Windows Command Prompt -> press + R, type “cmd” and press Enter – if “cmd” does not work, try “command”):
Running all these results in:
C:\Users\Hans\SomeTestFolder>dir
Volume in drive C has no label.
Volume Serial Number is 28BF-AD86
Directory of C:\Users\Hans\SomeTestFolder
08/24/2018 10:50 AM <DIR> .
08/24/2018 10:50 AM <DIR> ..
08/24/2018 10:47 AM 0 EmptyFile1.txt
08/24/2018 10:47 AM 0 EmptyFile2.txt
08/24/2018 10:48 AM 0 EmptyFile3.txt
3 File(s) 2,340,236 bytes
2 Dir(s) 26,341,277,696 bytes free
Windows PowerShell
With the arrival of PowerShell (press + R, type “powershell” and press Enter) under Windows, I had hoped the Linux trick would work, but it doesn’t – no “touch” to be found anywhere. Even worse … the good old DOS tricks didn’t work either.
After some searching I did find this trick:
I suppose the “official ” notation would be this:
New-Item test.txt -ItemType file
But … it works just fine without the additional “-ItemType file“.
Hope this is helpful …
Comments
There is only one comment, you can read it below.
You can post your own comments by using the form below, or reply to existing comments by using the "Reply" button.
[…] with names you made up. I’ve written for that purpose an article that shows you how you can make empty dummy files. Obviously FFprobe will not detect any media info, as there is none, but at least you can try and […]