Skip to content
horizzon3507Public

About

Extract CopyQ .cpq backups into ordered files by tab and item

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

16 Commits

Folders and files

Repository files navigation

exitq

exitq is a small Rust CLI that extracts CopyQ .cpq backup archives into plain files, ordered by tab and item.

A .cpq file is what CopyQ produces when you export tabs (File → Export). exitq turns one back into regular files, which is useful for grepping old clipboard history, migrating items into other tools, or recovering content CopyQ no longer shows.

exitq only extracts: it cannot create or restore .cpq archives, it does not read CopyQ's live data, and encrypted exports still require their password.

Build and install

Requires Rust 1.85 or newer.

cargo build --release
./target/release/exitq backup.cpq extracted

To install the binary into Cargo's bin directory:

cargo install --path .
exitq backup.cpq extracted

Usage

exitq <archive> <output-dir> [--password-file <file>]
Argument Meaning
<archive> Path to the .cpq backup.
<output-dir> Destination directory. It must not exist yet.
--password-file <file> Read the backup password from a file instead of prompting. A trailing newline is stripped.

Encrypted v5 backups prompt for a password without echoing it; --password-file exists for scripted use.

Extraction is all or nothing. Files are written to a hidden staging directory next to the destination and renamed into place only when every item succeeds — a wrong password, corrupt data, or an unreadable item aborts the run and leaves nothing behind.

Exit codes: 0 on success, 1 on any extraction or I/O error, 2 on invalid arguments.

Output layout

extracted/
├── manifest.json
├── settings.json             # only when the backup includes settings
├── commands.json             # only when the backup includes commands
├── 001_clipboard/
│   ├── 000001.txt
│   ├── 000001.html
│   └── 000002.png
└── 002_Notes/
    └── 000001.md

Items keep their order within each tab, and tab directory names are sanitized (non-alphanumeric characters become _). Every MIME format stored in an item becomes a file: common types map to extensions like .txt, .md, .html, .png and .jpg, unknown types get .bin, and one item can produce several files.

manifest.json

The manifest describes everything that was written:

{
  "format": "CopyQ CPQ",
  "archive_version": 5,
  "tabs": [
    {
      "index": 1,
      "name": "clipboard",
      "directory": "001_clipboard",
      "items": [
        {
          "index": 1,
          "files": [
            { "mime": "text/plain", "file": "001_clipboard/000001.txt", "bytes": 512 },
            { "mime": "text/html", "file": "001_clipboard/000001.html", "bytes": 2048 }
          ]
        }
      ],
      "item_count": 1
    }
  ],
  "total_items": 1,
  "has_settings": true,
  "command_count": 3
}

Archive support and memory

exitq reads CopyQ backup versions 1 through 5, including encrypted v5 exports. File paths stored as references inside a backup are preserved as data — exitq never opens them.

Versions 1 and 2 stream item by item. Versions 3 to 5 store each tab in Qt data blocks, so peak memory can reach the size of the largest tab; v3 stores all tab blocks together and can need memory close to the full backup size.

License

Apache License 2.0

About

Extract CopyQ .cpq backups into ordered files by tab and item

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages