The answer here is to use OS/400's Restore (RST) command. This is a fairly easy command to run, but there are one or two quirks to watch out for as you do it. Here's my drill for restoring a single directory to the IFS.
First, put the tape (or tapes) from the full system backup containing the IFS into your tape drive. This can get a little tricky because RST may be looking only for those tapes that contain your IFS data, and it may issue an error if you just put in the first tape in your option 21 backup set that doesn't contain your IFS data (the first tape generally contains the SAVSYS data as well as some IBM and user library backups and, possibly, your DLO files). To locate the proper IFS tapes to put in your tape drive, use the Display Tape (DSPTAP) command to look for the first tape in the backup set that contains a label called SAVyyyymmdd where yyyy=the year the backup set was created, mm=the month the set was created, and dd=the day of the month the set was created, as per my example:
DSPTAP DEV(TAP01) DATA(*LABELS) OUTPUT(*PRINT)
Put that tape in slot one of the drive, and then insert the remainder of the tapes from the backup set that were created after that tape into slot two and above.
Let's assume that your OS/400 tape drive name is TAP01. To restore this directory, type in the following RST command:
RST DEV('QSYS.LIB/TAP01.DEVD') +OBJ(('/test1*' *INCLUDE)) +SUBTREE(*ALL) +ALWOBJDIF(*ALL)
This RST statement tells OS/400 to restore all files and directories that match the /test1* pattern, which is a wildcard designation. The SUBTREE(*ALL) parameter tells OS/400 to also restore all the files and subdirectories contained under /test1. Note that there are different values for SUBTREE that allow you to specify whether or not you also want to restore the subdirectories contained under /test1. To restore just the /test1 directory without restoring any of its subdirectories, try coding SUBTREE(*NONE). To restore just the subdirectory structure under /test1 without restoring the files that exist in those subdirectories, try coding SUBTREE(*DIR).
If you're not using TAP01, substitute the name of your tape drive for TAP01. Because you're dealing with the IFS and your tape drive description exists in the DB2 UDB library, which is contained in the QSYS.LIB file system, the notation for specifying the tape drive's location must be listed in IFS format. This accounts for the QSYS.LIB/TAP01.DEVD coding.
Be careful with this command, because it will restore everything in that IFS directory with whatever you backed up from the tape, clobbering any changes you may have made to existing /test1 files since the backup. My general rule is that you should always walk on tiptoes when restoring directories and double-check everything before you press the Enter key. If you want to be more cautious, restore /test1 to a different IFS directory.
If you want to restore /test1 to a different IFS directory, say one called /restores off the IFS root (/), you could try coding the statement with the optional new object name (sometimes called pathname) part of the OBJ parameter, as follows:
RST DEV('QSYS.LIB/TAP01.DEVD') +OBJ(('/test1*' *INCLUDE '/restores*')) +SUBTREE(*ALL) ALWOBJDIF(*ALL)
When the new object name is left off this command (as in the first example), OS/400 defaults to restoring directly back to the directory name that was backed up. If you're restoring to a different directory, however, I recommend that you create your target directory in the IFS before you proceed. OS/400 might create it for you if you neglect to do so, but I always like to be as specific as possible in restore operations. Here's the statement to create a new IFS directory called /restores off the root of the IFS:
Once the directory is created and you restore your files, then you can pick and choose which files to transfer from /restores back to /test1. File transfer can be done either through green-screen commands or through iSeries Operations Navigator (OpsNav).
I'm partial to restoring files and directories to hold directories rather than directly to the originating location, because it gives me a chance to look at the files before I move them to their final destination.