Thanks for the structured query instructions . It does help, you have described setup and goals clearly. 

At this time I am stuck at the right way to approach the step 3, which is for each selected image file copy it to the new subfolder. It would have been easier, if the absolute file path (in the metadata csv) would have been equal to the actual file path of the data stored. The metadata is a product of Camelot software, therefore actual image path is not equal to the /Users/Vratika/Library/Application Support/camelot/Media/ce/ceab3647-bc09-45a3-9505-c17d5166d446.jpg.

Additionally the image name in the folder where data is stored is not the same as the one generated by Camelot as camelot generated random unique file names (in bold above). And I can not trace the folder in my system (i.e. Application support<<Camelot). Sorry for the complicated query. To summarise:

1. I need help to figure out a way to copy selected image file using the metadata csv to specific location. I could have done that using file.copy command if I was able to trace the directory of the 'absolute file path’ on my computer.
2. The actual data is stored in /users/Vratika/Desktop/13_14 and this dir path is different that that in absolute path column of the metadata
3. I am unable to locate metadata dir in my computer 

To make things easy I was able to solve the issue using CamtrapR but if you have any input on how to approach this using base R or for other similar issues, that will be helpful. I am not on campus otherwise I would have gone to one of the group meetings.


On 10-Oct-2018, at 8:42 AM, Hao Ye <[log in to unmask]> wrote:

Hi Vratika,

I'm going to try and rephrase your question because I think there are multiple elements to it, and that is making it difficult to help out. I would like the list to be a place where people feel comfortable asking for R help, and I think it will help everyone to see how to structure requests.

* multiple image files in a folder
* metadata that contains file paths for the images, and other info (see example csv attached)

In a new location:
* make subfolders for each individual species
* copy the corresponding image files into those subfolders

Then the steps seem to me to be:
1. read in the metadata into R
2. for each individual species, make a new subfolder (e.g. `/users/vratika/desktop/elephant/`)
3. for each image file for that species, copy it into the subfolder (e.g. `/users/vratika/desktop/elephant/<filename>`)

So, questions to you:
Which parts are you stuck on?
How do you want to choose the filename?
Do you want to save the metadata, and where? (I strongly recommend you do this, obvious choice might be `/users/vratika/desktop/image_metadata.csv`)

Hao Ye

On Tue, Oct 9, 2018 at 10:34 PM, Chaudhary,Vratika <[log in to unmask]> wrote:
Hi all

This is a question regarding file path change. I have an image database, from a  camera trap data management software (camelot) from which I need to seperate certain specific images into a different folder.  Each of the image has a metadata associated with it, one of the metadata being species tag. I want to extract only specific species in a separate folder.  It is a data frame where each row represents a single image which has a specific path (pasted below). Hence my question is regarding trying to change absolute file path in R, I am trying to do so using file.path but haven’t been successful. Alternatively, if I use file.copy - is there a way to choose ‘pattern’ so that species with a specific metadata (e.g. Elephant) gets selected. Also attached is the csv with first 10 rows of the data.

Thank you


 I would need to change the path to something like: 


from the existing path: 



1 /Users/Vratika/Library/Application Support/camelot/Media/ce/ceab3647-bc09-45a3-9505-c17d5166d446.jpg

2 /Users/Vratika/Library/Application Support/camelot/Media/1e/1e9ca86c-18a2-42c5-8903-0b8e1af46bc9.jpg

3 /Users/Vratika/Library/Application Support/camelot/Media/4e/4e6ead9b-b6fc-4c4d-b9c7-54055fe7a0d9.jpg

4 /Users/Vratika/Library/Application Support/camelot/Media/57/57953a3d-5083-4041-804e-7b6a0d00b546.jpg

5 /Users/Vratika/Library/Application Support/camelot/Media/59/59255c10-20da-4fa0-9b2b-1a9f3690f951.jpg

6 /Users/Vratika/Library/Application Support/camelot/Media/cb/cb256dc1-5958-4881-a3f5-12e80fcb178e.jpg

This list strives to be beginner friendly.  However, we still ask that you

PLEASE do read the posting guide https://urldefense.proofpoint.com/v2/url?u=http-3A__www.R-2Dproject.org_posting-2Dguide.html&d=DwIGaQ&c=pZJPUDQ3SB9JplYbifm4nt2lEVG5pWx2KikqINpWlZM&r=SEmRVMqAFbH_Cx3K2dozZfH2QG2rALCjx8XkDKdS6dE&m=Gwaby9SdCvf1bJvHiNRn2KzbAcRIXuuhQ4DVVeCUuo0&s=nnvHhuLL0Pvv2ZVeNiEfPRU5lY7OUpd0jJZSE17zeHA&e=

and provide commented, minimal, self-contained, reproducible code.

This list strives to be beginner friendly. However, we still ask that you PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

This list strives to be beginner friendly. However, we still ask that you PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.