Name

msfind — Find MSS files.

Synopsis

msfind [-project proj] path [path...] [expression...]

Description

The msfind command recursively descends the directory hierarchy from each MSS file or directory specified by path, evaluating a Boolean expression composed of the expressions (described below) for each MSS file encountered. At least one path must be specified.

Note

The msfind command can be very slow for large directory hierarchies. The use of the MSS holdings reporting tool is suggested for operations that only perform queries about MSS file metadata. Metadata modification operations affecting a large number of MSS files may be more efficiently done by submitting a request to the CISL Customer Support (see CISL Customer Support web site for contact methods) to have the MSS administrators perform the change.

The path operands do not accept MSS wildcards (shell patterns) for expansion. This will not be changed in the future. You can get similar behavior with the -name and/or -path expressions.

Options

-p[roject] proj

Supply proj as the project number for charging. Currently, no charging is done for metadata operations, so this option is a placeholder for when charging might be imposed.

Operands

path

A starting point in the directory hierarchy.

expression

The first argument that starts with - (hyphen), ! (bang), or ( (left parenthesis) and all subsequent arguments will be interpreted as an expression made up of the following primaries and operators. In the descriptions, wherever n is used as a primary argument, it will be interpreted as a decimal integer optionally preceded by a plus (+) or minus (-) sign, as follows:

+n More than n
n Exactly n
-n Less than n

Expressions

The following primaries are recognized:

-atime n

True if the difference between the MSS file access (read) time and the time msfind was started, rounded up to the next full 24-hour period, is n 24-hour periods.

-class cos

True if the class of service for a file matches cos.

-ctime n

True if the difference between the MSS file reference time and the time msfind was started, rounded up to the next full 24-hour period, is n 24-hour periods.

-depth

Always true. It causes a depth first traversal to be done such that all entries in the directory are acted upon before the directory itself. The default is to act on the directory before the entries in the directory.

-exec cmd [argument ...] ;

True if the invoked DCS command, cmd, returns a zero value as its exit status. The end of this expression must be terminated by a semicolon. Note that you may need to escape the semicolon to prevent your shell from interpreting it, and the semicolon must a separate argument to the msfind command. An cmd argument containing only the two characters {} shall be replaced by the current (absolute) MSS pathname. The current directory of cmd will be the current directory of msfind. Only other DCS MSS metadata commands that run on the DCS server may be named as cmd.

-mproj project

Evaluates as true if the MSS file project number is project.

Note

Directories do not have a project number.
-mtime n

True if the difference between the MSS file write time and the time msfind was started, rounded up to the next full 24-hour period, is n 24-hour periods.

-name pattern

True if the basename of the MSS file name being examined matches pattern as a shell pattern.

-newer file

True if the modification time of the current MSS file is more recent than the modification time of MSS file file.

-path pattern

True if the pathname being examined matches pattern as a shell pattern.

-period n

True if the retention period (in days) is n.

-print

Always evaluates as true; causes the current pathname to be written to standard output.

-prune

Always evaluates as true; causes msfind not to descend the current path if it is a directory. If ­depth is specified, -prune has no effect.

-ptime n

Evaluates as true if the initialization time subtracted from the estimated MSS file purge time is n-1 to n multiples of 24 hours. Note that the subtraction for purge times is reversed from other time comparisons since the estimated purge time is almost always in the future. If the estimated purge time is in the past, a zero value is substituted for the result of the subtraction.

-size n[c]

True if the MSS file size in bytes, divided by 512 and rounded up to the next integer, is n. If n is followed by the character c, the size is in bytes.

-type c

Evaluates as true if the type of the path is c, where c is d for a directory or f for an MSS file.

-user uname

Evaluates as true if the MSS file belongs to user uname, which may be either a scientist number or an MSS user name.

Note

Directories do not belong to any specific user.

The primaries can be combined using the following operators (in order of decreasing precedence):

( expression )

True if expression is true.

! expression

Negation of a primary; the unary NOT operator.

expression [-and] expression

Conjunction of primaries; the AND operator is implied by the juxtaposition of two primaries or made explicit by the optional -and operator. The second expression is not evaluated if the first is false.

expression -or expression

Alternation of primaries; the OR operator. The second expression is not evaluated if the first expression is true.

If no expression is present, -print is used as the expression.

Examples

Example 15. Find MSS files that are going to expire.

Find MSS files that will expire within the next 30 days. Note that the argument to the -ptime is -31, which means files that will expire in fewer than 31 days.

msfind /USER -ptime -31

Example 16. Remove selected MSS files with msfind.

Remove all MSS files in a user´s directory that are smaller than 100,000 bytes and are owned by project ´00000000´:

msfind /USER -type f -size -100000c -mproj 00000000 -exec msrm ´{}´ ;

Example 17. Find MSS files with specific class of service.

The following example would find all MSS files that have a class of service specifying economy reliability:

msfind /USER/dir -type f -class reliability=economy

Environment Variables

See Environment Variables section of the Command Behavior and Envrionment chapter for details.

Exit Status

See Exit Status Codes section of the Command Behavior and Environment chapter for details.

See Also

mschproj(1NCAR), msclass(1NCAR), mscomment(1NCAR), msls(1NCAR), msmv(1NCAR), mspasswd(1NCAR), msrawinfo(1NCAR), msrecover(1NCAR), msretention(1NCAR), msrm(1NCAR), mstouch(1NCAR)

Copyright

2008 University Corporation for Atmospheric Research, all rights reserved.