diff --git a/.gitignore b/.gitignore index 6f49e84..a023691 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,8 @@ references/ + +# Per-machine working config (created from config.template.ini on first run) +config.ini + +# Python bytecode cache +__pycache__/ +*.pyc diff --git a/README.md b/README.md index 4f681ca..6aa15d3 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,8 @@ Extracts and organizes documents from FileCabinet CS (Thomson Reuters) using GUI | File | Purpose | |------|---------| -| `config.ini` | All paths, timeouts, and FCCS control identifiers | +| `config.template.ini` | Tracked template for all paths, timeouts, and FCCS control identifiers | +| `config.ini` | Per-machine working config (git-ignored; auto-created from the template) | | `fccs_folders.txt` | FCCS folder templates (manually populated per engagement) | | `fccs_config.py` | Shared config loading, logging, folder pattern building | | `fccs_scan.py` | Step 1: Scan backup directory for drawer IDs | @@ -26,7 +27,7 @@ Extracts and organizes documents from FileCabinet CS (Thomson Reuters) using GUI ## Setup Per Engagement -1. Edit `config.ini` -- point `backup_dir`, `export_dir`, and `output_dir` at the client's directories. +1. Edit `config.ini` -- point `backup_dir`, `export_dir`, and `output_dir` at the client's directories. This file is created automatically from `config.template.ini` the first time you run any script (it's git-ignored, so your machine-specific paths never drift the repo). To reset a machine, delete `config.ini` and re-run. Keep shared/default changes in `config.template.ini` (the tracked file). 2. Populate `fccs_folders.txt` -- open FCCS > System Configuration > Document Folders and list each folder template exactly as shown, one per line. Keep the `YYYY` prefix on recurring folders. UltraTax CS folders are detected automatically and do not need to be listed. ## Workflow @@ -134,7 +135,7 @@ Any outstanding drawer that also appears in `crashed.txt` (its export was aborte ## Config Reference -All scripts read from `config.ini` (or specify `--config path\to\config.ini`). +All scripts read from `config.ini` (or specify `--config path\to\config.ini`). `config.ini` is the git-ignored, per-machine copy auto-created from the tracked `config.template.ini`; edit `config.ini` locally. - **`[paths]`** -- backup_dir, export_dir, output_dir, drawer_id_file, completed_file, ignore_file, crashed_file, log_file, verify_report, report_html, screenshot_dir, manifest_dir, folder_list - **`[timeouts]`** -- nav_timeout, dialog_timeout, progress_appear, progress_finish, settle, confirm_timeout diff --git a/__pycache__/fccs_check.cpython-313.pyc b/__pycache__/fccs_check.cpython-313.pyc deleted file mode 100644 index 0799fbc..0000000 Binary files a/__pycache__/fccs_check.cpython-313.pyc and /dev/null differ diff --git a/__pycache__/fccs_config.cpython-313.pyc b/__pycache__/fccs_config.cpython-313.pyc deleted file mode 100644 index e364cb9..0000000 Binary files a/__pycache__/fccs_config.cpython-313.pyc and /dev/null differ diff --git a/__pycache__/fccs_config.cpython-314.pyc b/__pycache__/fccs_config.cpython-314.pyc deleted file mode 100644 index 0d720ff..0000000 Binary files a/__pycache__/fccs_config.cpython-314.pyc and /dev/null differ diff --git a/__pycache__/fccs_reorganize.cpython-313.pyc b/__pycache__/fccs_reorganize.cpython-313.pyc deleted file mode 100644 index ec4b55a..0000000 Binary files a/__pycache__/fccs_reorganize.cpython-313.pyc and /dev/null differ diff --git a/__pycache__/fccs_report.cpython-313.pyc b/__pycache__/fccs_report.cpython-313.pyc deleted file mode 100644 index 77e4cc0..0000000 Binary files a/__pycache__/fccs_report.cpython-313.pyc and /dev/null differ diff --git a/__pycache__/fccs_scan.cpython-313.pyc b/__pycache__/fccs_scan.cpython-313.pyc deleted file mode 100644 index 69beba4..0000000 Binary files a/__pycache__/fccs_scan.cpython-313.pyc and /dev/null differ diff --git a/__pycache__/fccs_verify.cpython-313.pyc b/__pycache__/fccs_verify.cpython-313.pyc deleted file mode 100644 index b1e1494..0000000 Binary files a/__pycache__/fccs_verify.cpython-313.pyc and /dev/null differ diff --git a/config.ini b/config.template.ini similarity index 69% rename from config.ini rename to config.template.ini index 6adb962..895f398 100644 --- a/config.ini +++ b/config.template.ini @@ -1,3 +1,12 @@ +# --------------------------------------------------------------------------- +# TEMPLATE CONFIG — tracked in git. Do NOT edit for a specific machine. +# +# On first run the scripts copy this file to `config.ini` (which is git-ignored) +# and use that. Edit `config.ini` for this machine's paths/settings so your +# local changes never drift the repo. To reset a machine, delete `config.ini` +# and re-run; it will be recreated from this template. +# --------------------------------------------------------------------------- + [paths] # Point these at the current engagement's directories backup_dir = C:\Migration\Backups diff --git a/fccs_config.py b/fccs_config.py index bbfbcc4..657bea9 100644 --- a/fccs_config.py +++ b/fccs_config.py @@ -5,11 +5,13 @@ Shared configuration, logging, and utilities for the FCCS extraction tool. import os import re import sys +import shutil import argparse import configparser from datetime import datetime DEFAULT_CONFIG = "config.ini" +TEMPLATE_CONFIG = "config.template.ini" def parse_args(): @@ -24,12 +26,31 @@ def parse_args(): def load_config(path=None): - """Read config.ini and return a ConfigParser object.""" + """Read the config file and return a ConfigParser object. + + Config is split into two files: + - config.template.ini : tracked in git, the pristine template. + - config.ini : git-ignored, this machine's working copy. + + When no explicit --config path is given, the per-machine config.ini is used. + If it doesn't exist yet, it's created from config.template.ini so a freshly + cloned/pulled repo works out of the box without editing the tracked file. + Edit config.ini locally; your changes never drift the repo. + """ if path is None: script_dir = os.path.dirname(os.path.abspath(sys.argv[0])) path = os.path.join(script_dir, DEFAULT_CONFIG) + # Auto-create the per-machine config from the template on first run. + if not os.path.exists(path): + template = os.path.join(script_dir, TEMPLATE_CONFIG) + if os.path.exists(template): + shutil.copyfile(template, path) + print(f"Created {DEFAULT_CONFIG} from {TEMPLATE_CONFIG}. " + f"Edit it for this machine's settings: {path}") if not os.path.exists(path): print(f"ERROR: config file not found: {path}") + print(f" Expected {DEFAULT_CONFIG} or a --config path " + f"(template: {TEMPLATE_CONFIG}).") sys.exit(1) cfg = configparser.ConfigParser() cfg.read(path, encoding="utf-8")