If file exists then move

I have been googling and am not sure how to approach this. I have a
file that I need to match. The date string in the filename varies so I
want to match any date.

/path/to/file/hist_sar01-31-2013.tar

What options do i have for matching the/any date or string. Is there a
method for matching?

hist_sar*.tar

yes! You want to use a regex. May I suggest something like:
/hist_sar\d±\d±\d+.tar/

On Thu, Feb 14, 2013 at 4:59 PM, Sloan R. [email protected]
wrote:

if Dir[“/path/to/file/hist_sar*.tar”].empty?

code to run if no files matching pattern exist

else

code to run otherwise

end

You could also make the pattern more specific:

Example:
Dir[“/path/to/file/hist_sar{0,1}[0-9]-[0-3][0-9]-[0-9][0-9][0-9][0-9].tar”]