'How to loop and associate multiple uneven datasets using windows batch
EDIT 2.
I'm having a hard time wrapping my head around loops in windows batch.
I have datasets, and I'm trying to create a one-to-relationship with data in each. However, they aren't equal datasets.
pseudo code would be:
dataset1 \folder\pictures (10 jpgs with random names)
dataset2 db.csv (100 entries in a single column)
Loop through the db.csv, read the first entry and associate it with the first picture. On the 11th entry, begin with the first picture again, etc. (more robust of course, because the datasets aren't fixed amounts)
for /F "delims=" %%A in (db.csv) do (
ren random.jpg pic1-%%a
ren randomanother.jpg pic2-%%a (2nd entry db.csv)
...
ren random.jpg pic11-%%a (11th entry in db.csv)
ren randomanother.jpg pic12-%%a (12th entry in db.csv)
etc
)
I'm NOT looking to use the ren command, it's just an example of how the iteration would work. In the loop, the csv continues reading data, but applies it to the first picture file again.
It's the looping logic that I'm having no success with.
I suspect I might need to count the datasets or at least the pictures dataset to iterate the loops ? The pictures are not numbered sequentially initially, but I can easily rename them to be.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
