Exporting Files
Extracted files are unmodified copies of the original. This is often exactly what you want, but sometimes times you'd like the extracted file to be in a form that is more easily accessible on a modern system. CiderPress II includes a number of file converters for documents, code, and graphics. You can pick a specific converter, or let the application decide which is most appropriate.
Conversions are performed by the export command, which takes the same arguments as extract, but with the addition of an "export-spec". The export specifier tells CiderPress II how to do the conversion. To let cp2 choose the conversion automatically, use the export-spec "best":
cp2 export fileconv/test-files.sdk best Docs:sample.text Code:ZIPPY
exporting Docs/sample.text -> Docs\sample.text.txt [text] exporting Code/ZIPPY -> Code\ZIPPY.txt [disasm]
The command decided to do a simple text conversion on sample.text, and generated a disassembly for ZIPPY (which is a ProDOS 8 SYS program).
In this case, the disassembly of ZIPPY isn't quite right, because despite being a SYS program it actually includes 65816 code. We need to tell the converter to handle this a bit differently, which we can do by adding an option to the export spec:
cp2 export --overwrite fileconv/test-files.sdk disasm,cpu=65816,long=false Code:ZIPPY
Overwriting 'Code\ZIPPY.txt' exporting Code/ZIPPY -> Code\ZIPPY.txt [disasm]
This specifies the disasm converter, with the 65816 CPU, starting with short registers. (The complete list of converters and their options can be found in the full manual. A quick summary can be had from cp2 help export.)
This also snuck in the --overwrite flag, to tell cp2 to overwrite the existing file. This can be abbreviated -f ("force").
Exported files will be output in one of four basic formats, with an appropriate file extension added:
- Plain text (.TXT), in UTF-8 without a byte-order mark.
- Rich text (.RTF). Used for anything with fancy document formatting.
- Comma-separated value (.CSV). Used for spreadsheets, databases, and random-access text files.
- PNG bitmap (.PNG). Used for all graphics.
Files viewable directly on a modern system, such as GIF images and PDF documents, will be extracted without modification.
You can't specify conversion options when using "best" mode, but you can set defaults in the config file (more on that later).