I am trying to run exiftool through R to get metadata from photos using the system() command. When I run this on a mac, it works fine, but from windows I am not linking up with the cmd.exe properly and getting the following error from this code:
exif_datetime <- function(path) {
exif_cmd <- 'exiftool.pl -T -r -DateTimeOriginal '
cmd <- paste(exif_cmd, "'", path, "'" ,sep='')
exif_time <- system(cmd, intern = TRUE)
exif_time
}
photo_time <- exif_datetime('C:/Users/photo.jpg')
photo_time
Error in system(cmd, intern = TRUE) :
'CreateProcess' failed to run 'C:\Windows\exiftool.pl -T -r -DateTimeOriginal 'C:/Users/photo.jpg''
When I run the exiftool command from cmd.exe in Windows, I get the proper result. My exiftool.pl is in the C:Windows folder on my computer. Is there something regarding the PATH that I am missing? Also, I remember something about windows needing a shell, but I have not figured out if that is what I need in my case nor how to create one properly.