Hi, and welcome to the RStudio Community!
As prosoitos noted, list.files
will solve your first problem - for the second one, could please provide a short reprex, so that we can see an actual example? See also here. Otherwise, we can't be sure what you would like to obtain, exactly.