<div dir="ltr"><div><div><div><div><div><div><div>I have need to search a directory and return the name of the most recent file matching a given pattern.  Given a directory with these files and timestamps,<br><br>q.pattern1.abc Feb 13<br></div>r.pattern1.cdf  Feb 12<br></div>s.pattern1.efg  Feb 10<br>t.pattern2.abc Feb 13<br>u.pattern2.xyz  Feb 14<br>v.pattern2.efg  Feb 10<br><br></div>calling my_function("/path/to/dir", "pattern1") will return q.pattern1.abc and calling my_function("/path/to/dir", "pattern2") will return u.pattern2.xyz.<br><br></div>My question is, what would be a reasonable behavior/result/return value if:<br></div>1. "/path/to/dir" does not exist or is not readable<br></div>2. no files match the given pattern<br><br></div>Also, what would be a reasonable name for such a function?<br></div>