Batch File Processing and Desensitization Archiving
Daily office work accumulates a large number of files: meeting minutes, reports, notices, contracts… File names are chaotic, formats are inconsistent, and some contain sensitive data that needs processing. This case shows how to use LanMate to batch-organize files and complete desensitization before archiving.
Skills Used
- Built-in skills (installed with LanMate, ready out of the box): PDF handling (lanmate-pdf), Word documents (lanmate-docx), Excel spreadsheets (lanmate-xlsx)
- Skill Store: Batch File Renamer — batch-rename with preview; File Organizer — sort files into archive folders by type; Data Masking Tool — mask amounts, phone numbers, and more; File Conversion Guide — convert between PDF and Word
Pain Points
- Chaotic file names: “New Document (1).docx,” “Final Version.pdf,” “Final Version 2.pdf” — unidentifiable
- Inconsistent formats: the same type of file exists as Word, PDF, and images
- Contains sensitive data: amounts, phone numbers, etc. need desensitization before archiving or sharing
- Manual operations are error-prone: missed renames, files archived to the wrong directory
Recommended Workflow
| Step |
What LanMate Does |
What You Need to Confirm |
| 1 |
First use preview mode to view the rename and archive plan without executing it |
Whether the rules are correct |
| 2 |
Execute batch renaming (by date + type + sequence number) |
Whether the file count is conserved |
| 3 |
Format conversion (e.g., PDF to Word, Word to PDF) |
Whether content is complete after conversion |
| 4 |
Desensitize files containing sensitive data |
Whether the desensitization strategy is appropriate |
| 5 |
Generate an archive list Excel (file name, type, size, date) |
Whether the list corresponds to the actual files |
Prompt Examples
Batch Rename (Preview First)
Please batch-rename the files in the input directory using the following rules:
- Naming format: date_type_sequence (e.g., 20260815_meeting-minutes_001)
- Date taken from the file's modification date
- Type determined automatically by extension: .docx → document, .xlsx → spreadsheet, .pdf → PDF, .jpg → image
- Sequence number starts at 001, zero-padded to three digits
Please show the rename plan in preview mode first — do not execute it.
I'll confirm before you execute.
File Classification and Archiving
Please move the files in the input directory to archive directories by type:
- Documents (docx/pdf/txt) → archive/documents/
- Spreadsheets (xlsx/csv) → archive/spreadsheets/
- Images (jpg/png) → archive/images/
- Others → archive/others/
When files with the same name conflict, automatically add a sequence-number suffix.
Please show the plan in preview mode first — I'll confirm before you execute.
Sensitive Data Masking
Please apply desensitization to the numbers in "quarterly-financial-report.md":
- Desensitization strategy: blur (random offset, non-reversible)
- Processing scope: all amount figures (including units in ten-thousands and hundred-millions)
- Keep phone numbers unchanged (--skip-phone)
- Save the masking map to mask-map.json for restoration if needed
Output the desensitized file to the output directory.
Generate Archive List
Please scan the "archive" directory and generate an Excel archive list:
Fields: file name, file type, file size, modification date, directory location
Sort by modification date in descending order.
PDF to Word
Please convert "policy-document.pdf" in the input directory to a Word document.
After conversion, check content completeness: whether the page count, paragraphs, and tables are consistent with the original.
Output to the output directory.
Acceptance Criteria
- File count is conserved: the total number of files is the same before and after renaming and archiving
- Rename rules are consistent: all files follow the same naming format
- Sensitive data cannot be restored after desensitization (unless a hash/placeholder strategy is used and the mapping table is saved)
- The archive list corresponds one-to-one with the actual files
- Content is complete after format conversion, with no omissions
Common Mistakes
| Common Mistake |
Why It Happens |
Better Practice |
| Executing without previewing first |
Running directly leads to naming errors |
Confirm the plan in preview mode first, then execute |
| Not validating rules in a test directory |
Operating directly in the production directory |
Validate rule correctness in a small test directory first |
| Not saving the masking map |
Unable to restore after using a non-reversible strategy |
If restoration is needed, use a hash or placeholder strategy and save the mapping table |
| Not checking completeness after format conversion |
Assuming conversion always succeeds |
After conversion, check whether page count, paragraphs, and tables match the original |
| No backup before batch operations |
Operating directly on the original files |
Copy to a working directory first; keep the original files |