I want to make a directory name by extracting parts of a file name. Here are some examples:

1. `server.log.2016-03-20-14` → `20160320`
2. `server-2016-03-17-13-16-Restart.log` → `20160317`

I'm using HP-UX.