I want to write a simple loop that will create copies of all of the images in a folder (.jpg) and sort them into different folders according to the values in a table.
For example if I had three images and wanted to move them into folders according to this table:
I can read in the files using
files <- list.files(dir, pattern="*.JPG", full.names=TRUE, recursive=FALSE)
but I could use some help coding the loop that will use a conditional statement to create copies of the files in new folders using the appropriate string from the 'destination' column, which corresponds to the factor 'group'.
This is similar to this question and this question but different in that I want to copy images and rename them based on the values in the table rather than cycle through multiple tables.
Thank you in advance!!