user2854008 user2854008 -4 years ago 63
R Question

Find all file names that match a pattern

I am trying to find a way to list all file names in a folder that matches this pattern :

20131106XXXXX.pdf


The prefix is the date, and the content and length of
XXXX
vary across files, and I only care about pdf files.

Anyone could advise a way to do this?

Answer Source

Try this

list.files(path="./yourdir",pattern="[[:digit:]]{8}.*\\.pdf") 
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download