Hi @Rohit Kulkarni
Greetings & Welcome to the Microsoft Q&A forum! Thank you for sharing your query.
When using the "Flatten hierarchy" option in the Copy Activity's Sink tab, the output files may be saved with autogenerated names, which can result in ASCII character names instead of the intended file names. This behavior occurs because the "Flatten hierarchy" option does not preserve the original file names and instead generates new names for the files based on the internal processing.
Reference: Copy Activity
To achieve the desired outcome of saving the files with their original names in a single folder, you might consider the following options:
If you do not select the "Flatten hierarchy" option, the original folder structure will be preserved, and the files will be saved with their correct names in the respective folders. However, as you've noted, this can lead to the creation of duplicate folders.
Custom Naming - If you need to keep the "Flatten hierarchy" option, you might need to implement a custom naming convention or use a mapping that specifies how each file should be named during the copy process. This could involve using a data flow to rename the files after they are copied.
Check Dataset Configuration - Ensure that your dataset is correctly configured to point to the desired output folder and that the file naming conventions are set as needed.
By adjusting these settings, you should be able to control how the files are named and organized in your destination folder.
For more details refer to these documentations:
Copy and transform data in Azure Blob Storage by using Azure Data Factory or Azure Synapse Analytics
Copy data to or from a file system by using Azure Data Factory or Azure Synapse Analytics
I hope this information helps.
Kindly consider upvoting the comment if the information provided is helpful. This can assist other community members in resolving similar issues.