From 2b9d1bda129a016914ae8f3fe4f8752de370fc02 Mon Sep 17 00:00:00 2001 From: dat972 Date: Mon, 6 Jul 2026 16:48:10 -0500 Subject: [PATCH] tweaked reorganize so it only puts client names (drops ID) and the original filename instead of the full name that FCCS exports --- README.md | 10 +++++----- fccs_reorganize.py | 10 ++++++---- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 5f30b29..8f54a10 100644 --- a/README.md +++ b/README.md @@ -56,18 +56,18 @@ Parses the flat exported filenames and copies them into an organized structure: ``` output/ - 01069_ABRAHAM, REBEKAH L./ + ABRAHAM, REBEKAH L./ Tax Documents/ 2025/ - 01069_ABRAHAM, REBEKAH L._2025 Tax Documents_03-03-2026_030126 E-mail re Tax Info.pdf + 030126 E-mail re Tax Info.pdf Billing & Invoices/ 2026/ - 01069_ABRAHAM, REBEKAH L._2026 Billing & Invoices_030826 Invoice for 2025 Forms 1040...pdf + 030826 Invoice for 2025 Forms 1040 & IL-1040.pdf UltraTax CS/ 12-31-2008/ - 01069_ABRAHAM, REBEKAH L._UltraTax CS 12-31-2008_02-12-2009_2008 Form 1040 Filing Instructions.doc + 2008 Form 1040 Filing Instructions.doc Permanent File/ - 01069_ABRAHAM, REBEKAH L._Permanent File_02-24-2018_Driver's License.pdf + Driver's License.pdf _unparsed/ (files that couldn't be parsed go here for manual review) ``` diff --git a/fccs_reorganize.py b/fccs_reorganize.py index a881cf9..3fdaf7d 100644 --- a/fccs_reorganize.py +++ b/fccs_reorganize.py @@ -133,23 +133,25 @@ def main(): drawer_id, client_name, folder_parts, date, doc_name = result dest_dir = os.path.join( output_dir, - f"{drawer_id}_{client_name}", + client_name, *folder_parts, ) success += 1 os.makedirs(dest_dir, exist_ok=True) src = os.path.join(export_dir, filename) - dst = os.path.join(dest_dir, filename) + # For parsed files, use just the document name; for unparsed, keep original + dest_filename = doc_name if result else filename + dst = os.path.join(dest_dir, dest_filename) # Handle duplicate filenames if os.path.exists(dst): - base, fext = os.path.splitext(filename) + base, fext = os.path.splitext(dest_filename) counter = 1 while os.path.exists(dst): dst = os.path.join(dest_dir, f"{base}_{counter}{fext}") counter += 1 - log(f" DUPLICATE renamed: {filename} -> {os.path.basename(dst)}") + log(f" DUPLICATE renamed: {dest_filename} -> {os.path.basename(dst)}") shutil.copy2(src, dst)