Maybe this is what you're looking for:
Code:
#!/usr/bin/ksh
for i in $(ls -tr *[12][09][0-9][0-9][01][0-9][0-3][0-9]*); do
cp $i somelocation/$(echo $i | sed 's/^\(.*[^0-9]\)[12][09][0-9][0-9][01][0-9][0-3][0-9]\([^0-9].*\)$/\1\2/')
done
This is a very basic algorithm for detecting files with a datevalue in their names (yyyymmdd). It cuts out the datevalue from every filename found and writes the original files to a file with the stripped name.
E.g. every a_YYYYMMDD.dat file will be written to 'a_.dat' and every b_YYYYMMDD.dat file to 'b_.dat'. Because the filenames are fetched with 'ls -tr' (adopted from pdreyer, didn't know it would work without the long list...) the files are reversely sorted by timestamp and thus overwrite the previous (= older) file with the target filename.
Regards