IBM Power Systems

IBM Power Systems

About This Blog

Warm wishes and welcome to all AS400 Administrators and Operators.



This is exclusive blog for iSeries system Administrators working anywhere in the world. Also a place for guys and gals who want to share knowledge pertaining to iSeries. This blog has been designed for exchanging knowledge on AS400 or iSeries server administration and operations.



Tuesday, March 23, 2010

Copying an IFS Directory Using OS/400 Commands

The CPY command may be used to copy individual or groups of files (using wildcards) within the Integrated File System. CPY does not, however, copy nested subdirectories even if a wildcard value is specified. In many cases, the easiest method for copying an entire directory tree from one location to another in the Integrated File System is through the use of IBM iSeries NetServer functionality and a copy tool such as XCOPY or Microsoft Windows Explorer. If a PC is not available, a directory tree may be copied from an IBM iSeries family of servers system using only green screen commands. Using a SAVF as a go-between allows you to bypass the limitations of the CPY command when dealing with nested directories.
For example:
A user has a directory /MYDATA off the Integrated File System root. /MYDATA has three subdirectories:

/MYDATA/MEMOS
/MYDATA/FINANCE
/MYDATA/FINANCE/QUARTER
/MYDATA/FINANCE/ANNUAL
/MYDATA/INVOICE
/MYDATA/INVOICE/WORKING
/MYDATA/INVOICE/SHIPPED
/MYDATA/INVOICE/SHIPPED/LOCAL
/MYDATA/INVOICE/SHIPPED/AWAY

Each of these directories contains various files that the company wishes to make available to its employees. They do not want to give everyone authority to the user's /MYDATA directory and prefer to create a /PUBLIC directory that contains all of the information from /MYDATA.

To do this, perform the following steps:
1 To create a save file to hold your data, on the operating system command line type the following:
CRTSAVF FILE(MYLIB/MYSAVF)
Press the Enter key.
2 Save the desired Integrated File System directory to the save file using the SAV command. (Full parameters are shown in the screen shot.) On the OS/400 or i5/OS command line, type the following:
SAV DEV('/QSYS.LIB/MYLIB.LIB/MYSAVF.FILE') OBJ(('/MYDATA'))
Press the Enter key.











3 Restore the directory to a new location, in this example /PUBLIC. (Full parameters are shown in screen shot.) On the OS/400 or i5/OS command line, type the following:

RST DEV('/QSYS.LIB/MYLIB.LIB/MYSAVF.FILE') OBJ(('/MYDATA' *INCLUDE '/PUBLIC'))
Press the Enter key.













 
In addition to the original /MYDATA directory tree, there is now a /PUBLIC directory tree with copies of all of the files and directories from the original directory.






No comments:

Post a Comment