No, that is all required.
If skipping works, it is fine.
The bottom layer is the one which needs not to be changed.
It is already named as Background and needs to remain with the same name.
The following adds the digit for 3 or more layers, but no zero padding:
#target photoshop
function main() {
for (var i = 0; i < activeDocument.layers.length; i++) {
if (activeDocument.layers.length == 2) {
activeDocument.layers[0].name = "Parrot";
} else if (activeDocument.layers.length > 2 && activeDocument.layers[i].name != "Background" && activeDocument.layers[i] != activeDocument.layers[app.activeDocument.layers.length - 1]) {
activeDocument.layers[i].name = "Parrot-" + (i + 1);
}
}
}
activeDocument.suspendHistory("Undo Rename Layers Script...", "main()");
This version adds zero padding:
#target photoshop
function main() {
var zeroPadLength = 2;
var startNumber = 1;
for (var i = 0; i < activeDocument.layers.length; i++) {
if (activeDocument.layers.length == 2) {
activeDocument.layers[0].name = "Parrot";
} else if (activeDocument.layers.length > 2 && activeDocument.layers[i].name != "Background" && activeDocument.layers[i] != activeDocument.layers[app.activeDocument.layers.length - 1]) {
activeDocument.layers[i].name = "Parrot-" + zeroPad(startNumber, zeroPadLength);
startNumber++
}
function zeroPad(num, digit) {
var tmp = num.toString();
while (tmp.length < digit) {
tmp = "0" + tmp;
}
return tmp;
}
}
}
activeDocument.suspendHistory("Undo Rename Layers Script...", "main()");