# melissa-export-tools Automation scripts for Melissa's patient export workflow. ## Rename and Move PT STMT.bat Scans a root folder for patient export directories, renames `export.txt` with today's date, and moves it along with all `.tif` files into a new dated subfolder. ### What It Does For every folder found under the root that contains an `export.txt`: 1. Renames `export.txt` → `PT STMT_YYYYMMDD.txt` 2. Creates a new subfolder named `PT STMT_YYYYMMDD` 3. Moves the renamed `.txt` file into that subfolder 4. Moves all `.tif` files in the same folder into that subfolder ### Expected Folder Structure ``` ROOT\ \ Patient\ Export\ export.txt ← renamed and moved 1000001.tif ← moved 1000002.tif ← moved ``` After running: ``` ROOT\ \ Patient\ Export\ PT STMT_20260423\ PT STMT_20260423.txt 1000001.tif 1000002.tif ``` ### Setup 1. Place `Rename and Move PT STMT.bat` in the root patient folder 2. Double-click to run — it automatically uses the folder it lives in as the root ### Dry Run The script defaults to **dry run mode** — it will print every action it would take without touching any files. To run for real, open the file in Notepad and change: ```bat set "DRYRUN=1" ``` to: ```bat set "DRYRUN=0" ``` Dry run output looks like: ``` [DRY RUN] No files will be changed. Found: C:\Patients\abc\Patient\Export\. RENAME export.txt > PT STMT_20260423.txt MKDIR PT STMT_20260423 MOVE PT STMT_20260423.txt > PT STMT_20260423\ MOVE 1000001.tif > PT STMT_20260423\ MOVE 1000002.tif > PT STMT_20260423\ ``` ### Notes - Uses `pushd`/`popd` to work around Windows' 260-character path length limit - Safe to re-run — `mkdir` for the dated folder will silently skip if it already exists - Date format is `YYYYMMDD` (e.g. `20260423`)