Mac OS X operating systemsAIX operating systemsLinux operating systemsOracle Solaris operating systems

Archive data examples by using the command line

You request archive services when you want to preserve copies of files in their current state, either for later use or for historical or legal purposes. Examples of archiving data by using the command line are shown.

You can archive a single file, a group of files, or all the files in a directory or subdirectory. After you archive a file, you can choose to delete the original file from your workstation.

The following table shows examples of using the archive command to archive objects.

Table 1. Command line archive examples
Task Command Considerations
Archive all files in the /home/proj1 directory with a file extension of .txt. dsmc archive "/home/proj1/*.txt" Use wildcards to archive more than one file at a time.
Archive all files in the /home/jones/proj/ directory and delete the files on your workstation. dsmc archive /home/jones/proj/ -deletefiles Retrieve the archived files to your workstation whenever you need them again. For more information about the deletefiles option, see Deletefiles.
Archive the /home/jones/h1.doc and /home/jones/test.doc files. dsmc archive /home/jones/h1.doc /home/jones/test.doc If you specify the removeoperandlimit option with the archive command, the 20-operand limit is not enforced and is restricted only by available resources or other operating system limits. With this option, you can specify more than 20 files on a single command. For more information about this option, see Removeoperandlimit.
Archive a list of files in the /home/avi/filelist.txt file. dsmc archive -filelist=/home/avi/filelist.txt Use the filelist option to process a list of files. For more information, see Filelist.
Archive the /home/jones/ch1.doc file and assign a description to the archive. dsmc archive /home/jones/ch1.doc -description="Chapter 1, first version" If you do not specify a description with the archive command, the default is Archive Date:x, where x is the current system date. For more information about the description option, see Description.
Archive all of the files in the /home/jones/proj/ directory and its subdirectories. dsmc archive /home/jones/proj/ -subdir=yes For more information about the subdir option, see Subdir.
Use the v2archive option with the archive command to archive only files in the /home/relx/dir1 directory, but not the relx or dir1 directories. dsmc archive "/home/relx/dir1/" -v2archive The backup-archive client archives only files in the /home/relx/dir1 directory. Directories that exist in the path are not processed. For more information about the v2archive option, see V2archive.
Use the archmc option with the archive command to specify the available management class for your policy domain to which you want to bind your archived files. dsmc archive –archmc=ret2yrs /home/plan/proj1/budget.jan For more information about the archmc option, see Archmc. For more information about management classes, see Storage management policies.
Assume that you initiated a snapshot of the /usr file system and mounted the snapshot as /snapshot/day1. You archive the /usr/dir1/sub1 directory tree from the local snapshot and manage it on the IBM Spectrum Protect™ server under the file space name /usr. dsmc archive /usr/dir1/sub1/ -subdir=yes -snapshotroot=/snapshot/day1 The client considers the snapshotroot value as a file space name. For more information, see Snapshotroot.