Windows DOS batch script to search backup images for files...
An interesting forum post came up the other day, regarding how to search for files for possible restore. The post was a reminder of just how seemingly difficult it can be sometimes for backup admins to find files when the requestor of a restore isn't exactly sure where a file existed, or when - but the backup admin does have a rough idea of part of the folder name or part of the file name, and the backup admin has an idea of policy type.
I thought I'd have a go at writing something which could be used to search for files without necessarily knowing a policy name, or a client name... yet perhaps knowing the policy type, and perhaps a time frame, and to use wildcards to match somewhere along the folder path and/or file names.
One of the problems with using the CLI search/list tools for NetBackup is that the client based commands and the admin based commands require different swicthes, e.g. some commands require exact strings for policy type, whereas other commands require numbers for the policy type. Some commands use '-d' to specify a start date, and some use '-s'. And the switches for policy name and client can be different across different commands too. All of which can be a bit frustrating for the uninitiated.
Not only that, I wanted one script, which could be run on either a client, or a master/media/admin server, or both.
Hopefully this script will help admins track down some of those sometimes elusive files.
Attached are:
i) The script. (N.B: Pease do read the entire script header, usage, tips, notes, risks - before using).
ii) An example script log file.
iii) Example script output.