In Azure Data Factory (ADF), both the Copy Activity using wildcards (*.*) and the Get Metadata activity for retrieving a file list are designed to work with multiple files for copying or moving. However, they operate differently and are suited to different scenarios.
Copy Activity with Wildcard *.*
- Purpose: Automatically copies multiple files from a source to a destination using wildcards.
- Use Case: Used when you want to move, copy, or process multiple files in bulk that match a specific pattern (e.g., all
.csvfiles or any file in a folder). - Wildcard Support: The wildcard characters (
*for any characters,?for a single character) help in defining a set of files to be copied. For example:*.csvwill copy all.csvfiles in the specified folder.file*.jsonwill copy all files starting withfileand having a.jsonextension.
- Bulk Copy: Enables copying multiple files without manually specifying each one.
- Common Scenarios:
- Copy all files from one folder to another, filtering based on extension or name pattern.
- Copy files that were uploaded on a specific date, assuming the date is part of the file name.
- Automatic File Handling: ADF will automatically copy all files matching the pattern in a single operation.
Key Benefit: Efficient for bulk file transfers with minimal configuration. You don’t need to explicitly get the file list; it uses wildcards to copy all matching files.
Example Scenario:
- You want to copy all
.csvfiles from a folder in Blob Storage to a Data Lake without manually listing them.
2. Get Metadata Activity (File List Retrieval)
- Purpose: Retrieves a list of files in a folder, which you can then process individually or use for conditional logic.
- Use Case: Used when you need to explicitly obtain the list of files in a folder to apply custom logic, processing each file separately (e.g., for-looping over them).
- No Wildcard Support: The Get Metadata activity does not use wildcards directly. Instead, it returns all the files (or specific child items) in a folder. If filtering by name or type is required, additional logic is necessary (e.g., using expressions or filters in subsequent activities).
- Custom Processing: After retrieving the file list, you can perform additional steps like looping over each file (with the ForEach activity) and copying or transforming them individually.
- Common Scenarios:
- Retrieve all files in a folder and process each one in a custom way (e.g., run different processing logic depending on the file name or type).
- Check for specific files, log them, or conditionally process based on file properties (e.g., last modified time).
- Flexible Logic: Since you get a list of files, you can apply advanced logic, conditions, or transformations for each file individually.
Key Benefit: Provides explicit control over how each file is processed, allowing dynamic processing and conditional handling of individual files.
Example Scenario:
- You retrieve a list of files in a folder, loop over them, and process only files that were modified today or have a specific file name pattern.
Side-by-Side Comparison
| Feature | Copy Activity (Wildcard *.*) | Get Metadata Activity (File List Retrieval) |
|---|---|---|
| Purpose | Copies multiple files matching a wildcard pattern. | Retrieves a list of files from a folder for custom processing. |
| Wildcard Support | Yes (*.*, *.csv, file?.json, etc.). | No, retrieves all items from the folder (no filtering by pattern). |
| File Selection | Automatically selects files based on the wildcard pattern. | Retrieves the entire list of files, then requires a filter for specific file selection. |
| Processing Style | Bulk copying based on file patterns. | Custom logic or per-file processing using the ForEach activity. |
| Use Case | Simple and fast copying of multiple files matching a pattern. | Used when you need more control over each file (e.g., looping, conditional processing). |
| File Count Handling | Automatically processes all matching files in one step. | Returns a list of all files in the folder, and each file can be processed individually. |
| Efficiency | Efficient for bulk file transfer, handles all matching files in one operation. | More complex as it requires looping through files for individual actions. |
| Post-Processing Logic | No looping required; processes files in bulk. | Requires a ForEach activity to iterate over the file list for individual processing. |
| Common Scenarios | – Copy all files with a .csv extension.– Move files with a specific prefix or suffix. | – Retrieve all files and apply custom logic for each one. – Check file properties (e.g., last modified date). |
| Control Over Individual Files | Limited, bulk operation for all files matching the pattern. | Full control over each file, allowing dynamic actions (e.g., conditional processing, transformations). |
| File Properties Access | No access to specific file properties during the copy operation. | Access to file properties like size, last modified date, etc., through metadata retrieval. |
| Execution Time | Fast for copying large sets of files matching a pattern. | Slower due to the need to process each file individually in a loop. |
| Use of Additional Activities | Often works independently without the need for further processing steps. | Typically used with ForEach, If Condition, or other control activities for custom logic. |
| Scenarios to Use | – Copying all files in a folder that match a certain extension (e.g., *.json).– Moving large numbers of files with minimal configuration. | – When you need to check file properties before processing. – For dynamic file processing (e.g., applying transformations based on file name or type). |
When to Use Each:
- Copy Activity with Wildcard:
- Use when you want to copy multiple files in bulk and don’t need to handle each file separately.
- Best for fast, simple file transfers based on file patterns.
- Get Metadata Activity with File List:
- Use when you need explicit control over each file or want to process files individually (e.g., with conditional logic).
- Ideal when you need to loop through files, check properties, or conditionally process files.
Please do not hesitate to contact me if you have any questions at William . chen @ mainri.ca
(remove all space from the email account 😊)

