Showing results for 
Search instead for 
Did you mean: 
Partner    VIP    Certified

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.

Level 3

Hi sdo!  I was the person who was working so hard trying to get a search to run using a wildcard.  In the end the bpflist command did find the necessary files, but it WAS NOT with a wild card.  I had been trying to find any file ending in .pst.  My searches with *.pst were not working.  After much testing, the search did work when simply exclusing the *. 

This was the command I was able to use, specifying a date range, a client, a policy name, and the file .pst which resulted in all the files ending in .pst for the given date range (searched file name must be in quotes for me to get it to work):

E:\Program Files\Veritas\NetBackup\bin>bpflist -client oocsvondmp -d 04/01/2015
-e 06/28/2015 -pt NDMP -rl 999 -policy OOCNDMP04_nt05643f -option GET_ALL_FILES
| find ".pst" > c:\output10.txt

I read over your script (I'm in no shape a scripting person!) but have been working with NBU for over 10 years and I'm very familar with the product.  That is one confusing script.  I read thru it, and was lost after a bit.  So I will likely just stick to a simple command instead.  (no offense at all please! - I'm very impressed!)  Inside of your script you had this listed - I'm curious, how would I use the set z_match in my command above to try to get a wildcard to work.  Say I was looking for a .pst file, and I only knew part of the name.  How would that work?  I also saw something on it ignoring the case, which I do think would be handy!

Only the "set z_match=" line can have wild-card characters, of:
REM *		?	match any one single character
REM *		*	match zero or more of any character
Partner    VIP    Certified

When searching using bpflist we need the '-pattern string' argument if we want to match folder or file names.  And yes we quotes around the string being searched for when using the Windows DOS find command.

I've probably overcooked the script a bit - but in the end I wanted something that would give me the image header, and where the copies of an image were, and something that I could run on either a NetBackup Client or a NetBackup Server.  I could improve it I guess, and do it more the way you've done it - and use find - or better still use findstr and do some true regular expression pattern matching on folder and file names.  Plus I find the bplist output easier to read than the bpflist output.  Do you want an example of the equivalent command for bplist?

Anyway, here's an example of using bpflist with a wildcard pattern match - which should result in a smaller list sent back from the master, so it could be a little bit quicker (i.e. no big lists to filter through the find command) - but this is a moot point as it depends upon how many files there were in the original backup.  Here's the command:

"E:\Program Files\Veritas\NetBackup\bin\bpflist.exe" -client oocsvondmp -d 04/01/2015
-e 06/28/2015 -pt NDMP -rl 999 -policy OOCNDMP04_nt05643f -option GET_ALL_FILES IGNORE_CASE -pattern *.pst > c:\output10.txt

...which essentially achieves the same result as the command that you worked out.  :)

And if you only knew part of a surname for a PST file you could use:

-pattern *urn*.pst search for any PST files that have 'urn' in the file name, and a file extension of '.pst'.   And because we've used the IGNORE_CASE option - this would also match agianst:     *uRn*.pSt

Level 3

Hi again sdo,

We (Symantec engineer) and myself tried to use the wildcard * when doing the searches - none of them worked.  nut we used the find command not the pattern command!  I'm doing a test run now.  And I do like the part about ignoring the case!!

E:\Program Files\Veritas\NetBackup\bin\bpflist -client oocsvondmp -d 05/01/2015 -e 06/28/2015 -pt NDMP -rl 999 -policy OOCNDMP04_nt05643f -option GET_ALL_FILES IGNORE_CASE -pattern *.pst > c:\output11.txt

Command is running now.  I can see what it finds in the output file tomorrow!

Thanks so much for all your help!


Version history
Last update:
‎07-11-2015 12:07 PM
Updated by: