In the first video of our migration series, we showed how to retrieve documents from a local NAS and extract metadata based on their location in the file system. The goal: build a clean, structured metadata set to feed into a destination repository. Now it’s time for the next critical step: metadata transformation.
Many documents live in folder structures that implicitly carry business meaning. But how do you extract that meaning — reliably, at scale, and without manual scripting? In this video, we show how to dynamically enrich your documents using Fast2, by interpreting folder paths and transforming them into usable metadata — all without altering the original content.
Why Folder Structure Holds Hidden Metadata
In many real-life migrations, metadata isn’t stored in the document itself — it lives in the folder tree.
Departments, statuses, dates, or tags may be hidden in paths like:
-min.png?width=479&height=202&name=carbon%20(8)-min.png)
This structure holds valuable business context — department, year, status, and even specific tags — but it’s not machine-readable unless you extract it.
With Fast2, we automate this process in two simple steps:
- Split the file path into individual segments
- Parse those segments for key-value pairs
Step 1: Extract Folder Structure as Migration Metadata
We begin by configuring a task in Fast2 to analyze the document path — using the absolute_path property for each file.
Since we’re working on Windows, we use the folder separator to split the path into individual components. Each folder becomes a value, and we group all these segments under a new temporary metadata field: all_tree_sections.
🛠️ Important: This is migration-scoped data — it helps drive automation but doesn’t affect the document’s original metadata.
Once executed, every document in our batch is now associated with a list of folder names from its path — ready to be interpreted further.
Step 2: Dynamic Metadata Enrichment via JavaScript
Next, we use a more advanced Fast2 task that allows JavaScript scripting.
The script works as follows:
- Iterates through each document in the migration batch (or punnet, in Fast2 terms)
- Retrieves the all_tree_sections data created earlier
- Looks for segments that follow a key=value pattern
- For each match, it dynamically adds new metadata:
- Name: the left-hand side of the =
- Value: the right-hand side, stored as a string (could also be a number or date)
No need to predefine fields. No need to guess what values might exist. Fast2 adds only the metadata that’s actually found — making the process dynamic, flexible, and robust.
Results: Clean Metadata, Zero Hard-Coding
After running the task:
- All documents are enriched based on actual folder structure
- Missing metadata (like “stage”) is seamlessly filled in — but only where present
- No hard-coded logic or fragile assumptions are needed
Fast2 interprets the data as it is, not as we wish it to be — a key strength when dealing with unstructured or inconsistent sources.
🎬 Want to see it in action? Watch the video walkthrough to learn how Fast2 automates folder-based metadata enrichment !
What’s Next? Storing Documents and Metadata in AWS S3
Now that our documents are enriched with dynamic metadata, the next step is to store everything — content and metadata — in a scalable, cloud-native structure.
👉 In the next video, we’ll show how to use Fast2’s AWS injector module to upload documents to Amazon S3, along with metadata stored in JSON format, ready for future analysis, search, or AI-powered enrichment.
Useful Resources:
💡 Questions or ideas? Leave a comment under the video, and let's discuss the best practices for optimizing your own migrations!