One of our monitoring tools creates hourly csv files in a folder.
The structure of the file name is always the same "location" (e.g. Berlin, Munich) and "time" (hhmmss).
The files itself contain a header and some rows with data.
From all this files I need only the last from every location and from every hour. (below marked <==)
Berlin_091013.csv
Berlin_091014.csv
Berlin_091017.csv
Berlin_091019.csv <==
Munich_091005.csv
Munich_091006.csv
Munich_091007.csv
Munich_091008.csv <==
Munich_101005.csv
Munich_101006.csv
Munich_101007.csv
Munich_101008.csv <==
And from every of this files I need only the last record.
To exclude all the other files/records would be very helpful because there are about 50000 files in the folder and I need only about 400 rows.
But all my attempts failed.
Thanks in advance.