One of the more complicated facets of NetBackup is that the 'copy number' of a backup image bears no relation to its locality/residence/age or duplication life history. The copy number of a backup image is an arbitary number, and does not convey any meaning other than the fact that a copy of the image exists.
For example, imagine an SLP that has two stages. The first stage is a backup to disk stage, and this will typically create copy '1' of a backup image. The second stage is a duplication to tape stage, and this will typically result in the creation of second copy of the backup image with a copy number of '2'. Now imagine that through some turn of events long ago which was about to result in copy 1 of the image being lost, but before it was lost it was duplicated again to become copy 3 on another different disk pool. No we have a situation where most of the backup images follow the usual pattern of copy 1 is on disk, and copy 2 is on tape... however one of the images does not. If many changes and manual duplications have taken place, then the thought of selecting images by copy number alone becomes a risky proposition.
There are oocasions where one needs to be sure that one has identified all of the copies on a specific storage type, e.g. on disk... yet at the same time perhaps ignore these copies on disk... IF... they do not have a copy on tape. This script can help you do that. It is a curious thing that usually when one needs to identify backup images that fall in to these categories, then one is also usually wanting to identify the oldest of these. Hence this script will also identify and select images by date.
N.B: This script will not actually change anything. The sole purpose of this script is to produce a file containing just a list of backup image-IDs and the copy number for the copy that was found on the user selected type(s) of storage.
So, as it stands this script can be thought of as a reporting script, as it does not make any changes to NetBackup.
As ever, please carefully read the entire script header before attempting to use this script.
In fact, read it again Make sure that you understand its limitations.