DummyFile
Purpose
DummyFile is a CLI tool that lets you create a specified number of plain (ANSI) text files of a specific size.
The files are generated from random printable characters (plain text). Per default, the file's contents is generated as one
'big blob'. However, you can specify to add line feeds (actually LF + CR) to simulate 'proper text files'.
Download
DummyFile
Installation
None. Download the ZIP file, extract the included executable and run it.
Please note: this is a console application. You should run it from a command prompt.
Use case(s)
-
-
Pre-allocate (read: block!) hard disk space in convenient chunks for easy release sometime later.
-
-
Test file handling routines.
Syntax
DummyFile /n=<No. of files> /s=<file size> [/f=<folder to create files in>] [/lf] [/ll=<No. of characters per line>] [/fe=<file extension>]
Parameters:
-
/n = Number of files to create (mandatory)
-
/s = File size of each file (mandatory). File size format:
- <empty> = Byte, e.g. 100
- kb = Kilobyte, e.g. 100kb
- mb = Megabyte, e.g. 100mb
- gb = Gigabyte, e.g. 100gb
- Please note: 1 KB = 1024 byte, 1 MB = 1024 KB etc.
-
/f = Folder in which the file(s) should be created
-
/lf = Create files with line feeds (CrLf)
-
/ll = Line length (number of characters). Can only be used in conjunction with /lf.
-
/fe = File extension. Defaults to 'tmp'.
Examples
DummyFile /n=10 /s=12MB
Create 10 files (in the current folder) with a size of 12MB each, do not add line feed(s).
DummyFile /n=10 /s=12MB /f=c:\temp
Create 10 files in the folder c:\temp with a size of 12MB each, do not add line feed(s).
DummyFile /n=10 /s=12MB /f=c:\temp /lf
Create 10 files in the folder c:\temp with a size of 12MB each, add line feed(s). Line length defaults to 80 characters.
DummyFile /n=10 /s=12MB /f=c:\temp /lf /ll=72
Create 10 files in the folder c:\temp with a size of 12MB each, add line feed(s). Line length should be 72 characters.
DummyFile /n=10 /s=12MB /f=c:\temp /lf /ll=72 /fe=txt
Create 10 files with the file extension 'txt' in the folder c:\temp with a size of 12MB each, add line feed(s). Line length should be 72 characters.
Source code
The PowerBASIC source code is available at Github
Known issues / limitations
Version
-
3.1.0 - October 2021
-
Reworked the file content / file creation in order to work around memory limitations when creating large files.
-
3.0.0 - October 2017
-
The way command line parameters are handled has been change to accommodate the de facto standard of '/param=value' syntax.
-
A new parameter was add: /fe=file extension
-
2.0.4 - September 2017
-
Bugfix. The creation of very large files failed without any user notification, when running out
of RAM. This fix a) allows for a bit larger files to be created and b) if creation fails due to
memory limitation, an appropriate error message is displayed.
-
2.0.3 - May 2017
-
Compiler glitch workaround.
-
2.0 - August 2012