Skip to content

A Windows command line program to create a file of a given size, filled with garbage.

License

Notifications You must be signed in to change notification settings

delphidabbler/gbg

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

62 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gbg

A Windows command line program to create a file of a given size, filled with garbage.

Usage

gbg <filepath> <size> [options]
gbg -V
gbg

where

  • <filepath> is the path of the file to be created. If a full path is not provided then the file is created relative to the current directory.

  • <size> is the size of the file to be created. Supported sizes are 0 to 21,474,836,480 bytes (2GiB). Sizes must be entered in bytes as a decimal number, optionally including thousands separators.

  • [options] is zero or more of:

    • -a -- Generate random printable ASCII characters with code in range 32 to 126. Do not use with -A.

    • -A -- Generate random ASCII characters, including control codes, in range 0 to 127. Do not use with -a.

    • -l -- Program stops with an error if the requested output file size exceeds 500Mb. Do not use with -L.

    • -L -- Program silently creates a file of any requested size providing there is sufficient disk space. Do not use with -l.

    • -o -- Program stops with an error if the output file already exists. Do not use with -O.

    • -O -- Program silently overwrites any file with the same name as the output file. Do not use with -o.

  • -V on its own causes the program to display version information and exit

  • Providing no parameters causes the program to display brief usage information and exit.

Note that - can be replaced by / in options. E.g. -a can be specified as /a and -V can be specified as /V.

Operation

Files up to 10MiB in size are generated with random bytes. Files larger than 10MiB have the first 10MiB bytes generated randomly, but then that same 10MiB pattern is repeated as many times as necessary. If the requested file size is zero then an empty file is created.

By default, if a file size of more than 500,000,000 (500Mb) is entered then the user is asked to confirm the size. This behaviour can be overridden by specifying either the -l or -L options (see above).

If the given file already exists the user is asked to confirm that the file can be overwritten. This behaviour can be overridden by specifying either the -o or -O options (see above).

Installing & Uninstalling

gbg can be downloaded from the project's Releases page on GitHub. The download for each release is named gbg-exe-<version>.zip, where <version> represents the release version number.

The zip file contains:

  • GBG.exe - 64 bit version of the program. Always use this version on 64 bit operating systems.
  • GBG32.exe - 32 bit version of program. Only use on 32 bit operating systems.
  • README.txt - a read-me file that links to installation information.

There is no installation program. Simply copy GBG.xe or GBG32.exe to any folder on your computer and run it from there. gbg will happily run from USB or SD drives.

To uninstall simply delete the .exe file from wherever you copied it to.

ℹ️ The program does not alter your Windows installation. It creates no registry entries and does not create any configuration files.

Source Code

Full source code is available from the delphidabbler/gbg project on GitHub.

Contributing

Contributions are welcome.

The GitFlow methodology is used. Please fork the repository above then create a feature branch off the develop branch. When you have made your changes please rebase you branch onto develop then submit a pull request on GitHub.

⛔ Pull requests that have been branched from main will be rejected.

Compiling

gbg is compiled using Delphi 12.1. Delphi 11 may work, but has not been tested.

The program can be compiled from the Delphi IDE as 32 bit or 64 bit Windows targets and as either Debug or Release builds. Just choose the appropriate target platform and build configuration in the IDE before building.

The build chain requires DelphiDabbler Version Information Editor ~> v2.15.0 to be installed and for its installation path to be stored in the VIEDROOT environment variable. This environment variable can be set in the Delphi Tools | Options dialogue box in the IDE | Environment Variables section: use the User System Overrides section to set VIEDROOT.

Releases are built by calling Deploy.bat. See the comments in the file for usage information and details of dependencies. The script will compile the 32 and 64 bit release targets and generate a read-me file before finally creating a zip file containing them all.

Bugs and Feature requests

To suggest new features or report bugs use the gbg Issues page on GitHub.

License

gbg is MIT licensed. See LICENSE.md.

Change Log

Changes in each release are documentation in CHANGELOG.md.