2.0 KiB
2.0 KiB
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:
- Renames
export.txt→PT STMT_YYYYMMDD.txt - Creates a new subfolder named
PT STMT_YYYYMMDD - Moves the renamed
.txtfile into that subfolder - Moves all
.tiffiles in the same folder into that subfolder
Expected Folder Structure
ROOT\
<patient_id>\
Patient\
Export\
export.txt ← renamed and moved
1000001.tif ← moved
1000002.tif ← moved
After running:
ROOT\
<patient_id>\
Patient\
Export\
PT STMT_20260423\
PT STMT_20260423.txt
1000001.tif
1000002.tif
Setup
- Place
Rename and Move PT STMT.batin the root patient folder - 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:
set "DRYRUN=1"
to:
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/popdto work around Windows' 260-character path length limit - Skips any folder whose path contains
PT STMTorarchiveso already-processed folders are never re-processed - Safe to re-run —
mkdirfor the dated folder will silently skip if it already exists - Date format is
YYYYMMDD(e.g.20260423)