List Adobe Reader patches, chronological order, command line

Finally i have to do something awesome.

My previous post about Slipstream patch in Adobe Reader 9, 10 or 11 needed to be updated. Again.

Today's challenge is how to list Adobe Reader patches in correct order cause some patches starts with AdbeRdrSecUpd.. and some with AdbeRdrUpd... When i group these files in alphabetic order the list is sorted wrong and it is bad.

If we have a closer look we can see that all patches ends with and number which symbolize the order in array.
We need to do something.

Here is how i implement list the patches in correct order:
Files needed to accomplish the script:

Some explanations:
For example if we have AdbeRdrUpd11004.msp and AdbeRdrSecUpd11005.msp
The dir /b "%~dp0AdbeRdr*.msp" command will list this patches as:
AdbeRdrSecUpd11005.msp
AdbeRdrUpd11004.msp
sed "s/.*Upd//g" will cut all characters from left till "Upd" including "Upd":
11005.msp
11004.msp
awk -F ":" "{print $1 | """sort"""}" will group all numbers alphabetically:
11004.msp
11005.msp
dir /b "%~dp0*%%a" will find back full file name searching by number pattern which now is in correct order.
%%a is line element of array:
AdbeRdrUpd11004.msp
AdbeRdrSecUpd11005.msp

No comments: