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 was designed to be used is as follows: 


1. The administrator uses the HPSS root account to make a copy of a user

 file, perhaps to a hidden directory, or perhaps to a file in the same directory with a different suffix.

 2. The crename command is used to verify that both the original and copied files meet the mandatory and optional criteria described below. If so, then:

   A. The owner, group, account and permissions and Nameserver attributes

(utime fields) of the original file are copied to the new file.

  B. The original file is temporarily renamed by appending a tilde ("~")  character

  C.. The new file is renamed to the original filename.

  D. The original file is optionally deleted if all went well.


This command, in conjunction with the "cp" command, provides approximately the same functionality as "chcos".  However, since multiple HSI sessions can be run in parallel, it is often faster to use cp/crename than to use the HPSS single-threaded "chcos" capability.

Aliases: 

 

Command Format: 

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

Options: 

-d : delete original file if the rename operation succeeds

-s : suffix string to append to orig_path when renaming it. Default is "~"

-ocos : Filter option. If specified, the Class of Service of file "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 of file "new_path" must be one of the comma-separated COS IDs specified, or the command will fail.

Keywords: 

 

Usage Notes: 

  1. 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