A small command-line tool that recursively converts Apple II disk images to .NIB format using CiderPress II.
Point A2NibConvert at a folder of assorted Apple II disk images and it will walk through every folder it finds inside, converting any .PO, .DO, and .DSK files into .NIB.
Along the way, it also cleans up anything it can't use. Disk images that can't be converted to .NIB — because they're the wrong size, or because they're in a format this tool doesn't handle at all (.WOZ, .2MG) — are deleted, and if that leaves a folder completely empty, the folder is removed too.
Note: this deletion happens automatically, every time the script runs — it's not optional. Run with
--dry-runfirst if you want to see what would be removed before it actually happens. A file that fails the CiderPress II conversion itself (rather than being an unsupported format) is left alone and just reported, since a failure isn't always a sign the disk image is bad.
I built this for use with the MEGA65's Apple II core, which currently only supports the .NIB disk image format. Tracking down usable Apple II disk images online turned out to be harder than expected, since most of what's out there is in .DSK or .PO format. A2NibConvert was my way of taking everything I'd collected and converting it to .NIB in one pass, instead of doing it one disk at a time.
The MEGA65 Apple II core was the main reason I built this, but it should be just as useful for any other project or emulator that expects .NIB images.
- CiderPress II, with its folder added to your system
PATHso A2NibConvert can find thecp2command-line tool it uses to do the actual conversion. - A Python interpreter (Python 3.7 or later), if you don't already have one installed.
Once both of those are in place, run the script with -h to see the available options:
python A2NibConvert.py -h
usage: A2NibConvert.py [-h] [--cp2 CP2] [--delete-original] [--overwrite] [--dry-run] [--verbose] [--log-file LOG_FILE] [--log-skipped-only] folder
Recursively convert .PO/.DSK/.DO Apple II disk images to .NIB using CiderPress II's cp2.
positional arguments:
folder Folder to scan recursively for .PO/.DSK/.DO files
options:
-h, --help show this help message and exit
--cp2 CP2 Path to the CiderPress II cp2/cp2.exe executable (default: 'cp2', assumes it's on PATH)
--delete-original Delete the original .PO/.DSK/.DO file after a successful conversion
--overwrite Re-convert and overwrite .NIB files that already exist (default: skip them)
--dry-run Show what would be converted without actually running cp2 or deleting anything
--verbose Show the cp2 commands being run and their output
--log-file LOG_FILE Also write a record of the run (conversions, failures, and every skip with its reason) to this file. Created if missing, appended to
if it already exists.
--log-skipped-only With --log-file, write only the skipped files (and why) to the log file, instead of the full run. The console output is unaffected
either way.
The options are fairly self-explanatory and let you customise the conversion process — for example, previewing a run with --dry-run before doing it for real, or keeping a log of exactly what got skipped and why with --log-file.