auto generate the ignore list then we can manually adjust for locked drawers

This commit is contained in:
2026-07-09 16:44:19 -05:00
parent 60cc36893e
commit acd985432e
3 changed files with 74 additions and 14 deletions

View File

@@ -36,10 +36,15 @@ python fccs_scan.py
Reads the restored FCCS backup directory and writes all drawer IDs (subfolder names) to `drawer_ids.txt`. It also: Reads the restored FCCS backup directory and writes all drawer IDs (subfolder names) to `drawer_ids.txt`. It also:
- **Flags prefix clashes** — if one drawer ID is a prefix of another (e.g. `02218` and `02218A`), searching the shorter ID in FCCS pops up a selection box that breaks automated navigation. These are reported so you can export them manually or ignore the shorter ID. - **Flags prefix clashes** — if one drawer ID is a prefix of another (e.g. `02218` and `02218A`), searching the shorter ID in FCCS pops up a selection box that breaks automated navigation. These clashes are reported, and the shorter (prefix) IDs are auto-seeded into `ignore.txt` for review.
- **Reports ignored drawers** — any IDs listed in `ignore.txt` that exist in this backup are shown as ones the export will skip. - **Reports ignored drawers** — any IDs listed in `ignore.txt` that exist in this backup are shown as ones the export will skip.
**Ignoring drawers:** To exclude specific drawers from export (e.g. password-protected folders that would stall the automation), add their IDs to the file at `ignore_file` (default `C:\Migration\ignore.txt`), one per line. `drawer_ids.txt` stays a full inventory; the export skips anything in the ignore list. Lines starting with `#` are treated as comments. **Ignoring drawers:** The scan creates `ignore.txt` (at `ignore_file`, default `C:\Migration\ignore.txt`) if it doesn't exist and pre-fills it with the clash prefixes — searching those in FCCS shows a selection box that stalls the automation, so they're skipped by default. Open the file and:
- **Delete or comment out** any clash prefix you actually want exported (then handle it manually in FCCS).
- **Add** any other drawers to skip (e.g. password-protected folders), one ID per line.
Re-running the scan never overwrites your edits — it only appends newly-discovered clashes. `drawer_ids.txt` stays a full inventory; the export skips anything active in the ignore list. Lines starting with `#` are comments.
### Step 2: Export Documents ### Step 2: Export Documents

Binary file not shown.

View File

@@ -13,6 +13,61 @@ from fccs_config import (
) )
_IGNORE_HEADER = [
"# Drawer IDs to SKIP during export (one ID per line).",
"# Lines starting with # are comments and are ignored.",
"#",
"# Add password-protected or otherwise-excluded drawers here.",
"#",
"# The IDs auto-added below are prefix clashes: searching them in FCCS",
"# pops a selection box that breaks the automation, so they're skipped by",
"# default. DELETE or comment out any you actually DO want exported (then",
"# handle them manually), and keep the rest.",
"",
]
def update_ignore_file(ignore_file, clashes, log):
"""Create ignore.txt if missing and seed it with clash prefix IDs.
Never overwrites existing entries — only appends clash prefixes that
aren't already present. The shorter (prefix) ID of each clash is the one
that triggers the FCCS selection box, so it's the candidate to skip.
Returns the list of IDs that were added.
"""
existing = set(load_lines(ignore_file))
file_exists = os.path.exists(ignore_file)
to_add = [(short, matches) for short, matches in clashes
if short not in existing]
# Existing file already covers every clash — leave it untouched.
if file_exists and not to_add:
return []
lines = []
if not file_exists:
lines.extend(_IGNORE_HEADER)
for short, matches in to_add:
lines.append(f"# clashes with: {', '.join(matches)}")
lines.append(short)
mode = "a" if file_exists else "w"
with open(ignore_file, mode, encoding="utf-8") as f:
if file_exists:
f.write("\n") # separate the new block from prior content
f.write("\n".join(lines) + "\n")
added = [short for short, _ in to_add]
if not file_exists:
log(f"Created ignore file: {ignore_file}")
if added:
log(f"Added {len(added)} clash prefix ID(s) to ignore list: "
f"{', '.join(added)}")
return added
def main(): def main():
args = parse_args() args = parse_args()
cfg = load_config(args.config) cfg = load_config(args.config)
@@ -37,14 +92,6 @@ def main():
log(f"Found {len(drawer_ids)} drawers, written to {output_file}") log(f"Found {len(drawer_ids)} drawers, written to {output_file}")
# Report which drawers are set to be ignored (skipped by the export).
ignored = set(load_lines(ignore_file))
if ignored:
present = sorted(ignored & set(drawer_ids))
log(f"Ignore list ({ignore_file}): {len(ignored)} IDs, "
f"{len(present)} present in this backup — these will be SKIPPED "
f"by fccs_export.py: {', '.join(present) if present else '(none present)'}")
# Flag prefix clashes: FCCS search on the shorter ID pops a selection box. # Flag prefix clashes: FCCS search on the shorter ID pops a selection box.
clashes = check_for_clashes(drawer_ids) clashes = check_for_clashes(drawer_ids)
if clashes: if clashes:
@@ -52,15 +99,23 @@ def main():
log(f"WARNING: {len(clashes)} potential drawer ID clash(es) found.") log(f"WARNING: {len(clashes)} potential drawer ID clash(es) found.")
log("Searching the shorter ID in FCCS may show a selection box " log("Searching the shorter ID in FCCS may show a selection box "
"instead of navigating directly, which breaks the export.") "instead of navigating directly, which breaks the export.")
log("Consider exporting these manually, or add the shorter ID to "
f"the ignore list ({ignore_file}).")
for short, matches in clashes: for short, matches in clashes:
flag = " [ignored]" if short in ignored else "" log(f" {short} -> also matches: {', '.join(matches)}")
log(f" {short}{flag} -> also matches: {', '.join(matches)}") # Seed ignore.txt with the clash prefixes for review (never overwrites).
update_ignore_file(ignore_file, clashes, log)
log(f"Review the ignore list: {ignore_file}")
log("-" * 60) log("-" * 60)
else: else:
log("No drawer ID prefix clashes found.") log("No drawer ID prefix clashes found.")
# Report which drawers will be skipped by the export.
ignored = set(load_lines(ignore_file))
if ignored:
present = sorted(ignored & set(drawer_ids))
log(f"Ignore list ({ignore_file}): {len(ignored)} IDs listed, "
f"{len(present)} present in this backup — these will be SKIPPED "
f"by fccs_export.py: {', '.join(present) if present else '(none present)'}")
if __name__ == "__main__": if __name__ == "__main__":
main() main()