Xtract is a Python script for extracting files from Egosoft's X4 Foundations .cat archives. It allows you to selectively extract files by type or by specific file name, making it easier to work with modding or data analysis for X4 Foundations.
- Extracts files from
.cat/.datpairs in a given directory - Supports filtering by file extension (e.g., xml, html, js, css, lua)
- Optionally extract only specific files
- Verbose logging for debugging
- Python 3.8+
- Rich 14.1+
python xtract.py <source_directory> <destination_directory> [options]<source_directory>: Directory containing.catfiles (and their corresponding.datfiles)<destination_directory>: Directory where extracted files will be saved
-i,--include: List of specific.catfiles to extract (default: all found)-t,--types: Comma-separated list of file extensions to extract (default: xml, xsd, html, js, css, lua)-e,--expansions: Auto-detect and extract official expansions-v,--verbose: Enable verbose logging for debugging
Extract all XML, HTML, and JS files from a Steam install:
python xtract.py /home/username/.local/share/steam/steamapps/common/X4\ Foundations /output -t xml,html,jsExtract only *.xml files from cat file 01 and 02:
python xtract.py /path/to/cats /output -i 01.cat 02.cat -t xmlBy default, only warnings and errors are logged. Use -v or --verbose for detailed debug output.
- The script expects
.catand corresponding.datfiles to be present in the source directory. - Only files with the specified extensions will be extracted.
- The script creates output directories as needed.
Pull requests and issues are welcome! Please ensure code follows PEP8/ruff formatting and is well-documented.
This project is licensed under the GNU General Public License v3.0. See the LICENSE file for details.