Hi Ana,
yes, currently the
function stops and throws an error if the target directory is not
empty (contains images already). So in the first iteration of your
loop it works (when the directory is still empty), in the second
iteration it finds images and refuses to continue.
The relevant code it
quite old and I believe I added it to avoid accidentally
overwriting images that were tagged already (thereby potentially
losing the tags). And it also wasn't intended to contain
subdirectories by year. The function is not very flexible to be
honest.
So I'm sorry to say that
in its current state, there is little the function can do out of
the box. You could do one of these things:
- change the
directory structure
- modify the
getSpeciesImages function (the line that causes the error).
Since you are new to R I
did the latter for you. Please source the attached
getSpeciesImages function. It is minimally modified and causes a
warning instead of an error in your situation (line 52). Please
use it carefully since it may overwrite existing images. I also
don't know if the function would preserve the year directories you
are using. Just try and see, but please make a backup first.
Also run this line
first, it loads a few functions that getSpeciesNames needs
internally:
Hope this helps. And
please let me know how it goes.
All the best,
Jürgen