CRENAME Command

HSI Version:

All

Purpose:

Conditionally renames an existing file,by swapping attributes with a replacement file. This command exists to assist with the administrative problem of copying files from one media type to another, or from one class of service (COS) to another, while preserving the owner,group id, account ID, and modification times of the existing file. The scenario in which this command is intended to be used is as follows:

  • The administrator or user copies an existing file to a new file on a different class of service
  • The crename command is used to verify that both the original and copied files meet the mandatory criteria and optional criteria described below.

If so, then:

  1. The owner, group, account and permissions and Nameserver attributes (utime fields) of the original file are copied to the new file.
  2. The original file is temporarily renamed by appending a tilde ("~") character
  3. The new file is renamed to the original filename.
  4. The original file is optionally deleted if all went well.

The mandataory criteria are:

  1. Both the original and new files must exist
  2. Both must be regular files, not symlinks or directories
  3. The files must be exactly the same size

The optional criteria are:

  1. If specified via the -ocos option, the existing file must reside in one of the specified Classes of Service
  2. If specified viathe -ncos option, the new file must reside in one of the specified Classes of Service
Aliases:  

Command Format:

cren[ame] [-d] [-ocos cosid[,cosid ...]] [-ncos cosid[,cosid ...]] new_path orig_path

Options:

-d : delete original file if the rename operation succeeds

-ocos : Filter option. If specified, the Class of Service for "orig_path" must be one of the comma-separated COS IDs specified, or the command will fail.

-ncos : Filter option. If specified, the Class of Service for "new_path" must be one of the comma-separated COS IDs specified, or the command will fail.

Keywords:

 

Usage Notes:

  1. Both files must reside in the same HPSS.
  2. Both files must exist, or the command will fail.
  3. Both files must be exactly the same size.
  4. The CRENAME command currently does not preserve HPSS ACLs.

Example:

Create a copy of an existing file in Class of Service 22:

cp cos=22 file.old file.new

Conditionally rename the new file so that it replaces the existing file, while preserving timestamps,as well as owner, group and account IDs. file.new will only replace file.old if it was written to COS 22, and is exactly the same size as file.old:

crename -ncos 22 file.new file.old

Related Command(s):

RENAME, CHOWN, CHMOD CHACCT