This question already has an answer here:
- Select greatest numbered filename 2 answers
I'm googling for this, but the terms are so generic I'm getting way too many false positives, so what the hey, I'll ask here. I'm sure there's a simple answer but I don't generally script in *nix.
I'm trying to write a database refresh script to our test environment. The backups are mounted from an smbfs share, something like
/data/backups/prod, but the subfolders get a little tricky. It looks like
myproddbserver/yyyymmdd, with a bunch of files underneath.
I want to execute a command
restore that will collect the files with known names from the most recent
yyyymmdd directory. For example, if I had:
myproddbserver/20130630/foo.bak myproddbserver/20130630/bar.bak myproddbserver/20130731/foo.bak myproddbserver/20130731/bar.bak
I would want to restore
How would I reliably get those paths?