I’m trying to create a list of files from a directory containing files with the following patterns:
Name_Surname_12345_noe_xy.xls
Name_Surname_12345_xy.xls
xy can be one or two characters.
Now I want a list of all files wich do not contain “noe” in the filename.
I can read in only “noe” – files using
fl = list.files(pattern = "noe.+xls$", recursive=T, full.names=T)
but found no way to exclude them. Any suggestions?
Many thanks
Markus
Get all the files and then use
grepto find thenoeones and subset them out:always make sure you check the edge cases where all or none of the files match:
Using grep with a negative index works except in these edge cases:
Epic fail! Reason is left as an exercise to the reader.