Once you download the needed files, you would want to have them indexed by DAM. In the Chapter 2 recipe Creating a frontend upload form we already indexed files uploaded from the frontend, and in this recipe, we will index files in the backend (which is much easier!)
Indexing creates DAM records for files, extracting metadata in the process (using services). When files are uploaded through DAM, this process is triggered automatically, but when we download (or upload) files ourselves, we need to remember to ask DAM to index the new files.
We will design the code to work with and without DAM installed. Once again, we skip the steps needed for the rest of the code, and just focus on the heart of the matter. You can use this in various contexts, such as backend modules or CLI scripts.