Tools: MPW
Advanced Search
Apple Developer Connection
Member Login Log In | Not a Member? Support

MPW Command Reference


Move

Built-in

SYNTAX

Move name1 [name2]… targetName [-c | -n | -y] [-f] [-p] [-rs] [-rt]

DESCRIPTION

The Move command moves the files or directories in the name parameter to a target file or directory. Note that moved objects retain their current creation and modification dates.

Specifying a filename for both the name and targetName parameters allows you to rename a file. If the targetName parameter happens to be a file or folder that already exists (as opposed to being an invented name), a dialog box requests confirmation before overwriting its contents. You can use the -c, -n, or -y options in scripts to handle this request noninteractively.

INPUT

None

OUTPUT

None

ALIAS RESOLUTION

By default, the Move command does not resolve leaf aliases for either the source parameter (name1 [name2]…) or the target parameter (targetName). This enables you to move or overwrite Finder alias files.

You can override this default behavior and instruct Move to resolve Finder aliases for both the source parameter and the target parameter by using the options -rs or -rt, respectively.

STATUS

Move can return the following status codes:

0

no errors

1

syntax error

2

error during the move

4

Cancel selected or implied by -c

PARAMETERS

name1 [name2]…

Specifies one or more files or directories to be moved. When you specify a directory, its contents, including all subdirectories, are also moved. Note that you cannot move a directory that is a parent of targetName.

targetName

Specifies the target file or directory. If you specify a file or a target name that does not exist, the file or directory name replaces the target file or directory. Remember that a confirmation dialog box appears if the move would overwrite an existing file or folder.

If you specify a directory instead of a target file, the command moves the files and directories in name into the targetName directory.

OPTIONS

-c

Prevents the display of any confirmation dialog boxes by automatically responding Cancel. This causes Move to abort before overwriting an existing file or folder.

-f

Specifies that the resulting files should preserve Finder locations, i.e. the file icon in the destination window will be in the same physical location as the corresponding icon in the source window. The default is that the icon may be located in a position of the Finder's choice.

-n

Prevents the display of any confirmation dialog boxes by automatically responding No. This causes Move to skip over the current move (that is, the one that would overwrite an existing file or folder) and continue with the next.

-p

Lists progress information as the move proceeds.

-rs

Resolves a finder alias that occurs as the last item in the source parameter's path (name1). For instance, if the source parameter (name1) is a Finder alias that references a folder, then this option resolves the Finder alias and the contents of the folder that the Finder alias references are moved.

-rt

Resolves a finder alias that occurs as the last item in the target parameter's path (targetName). For instance, if the source parameter (name1) is one item and targetName is a Finder alias file, then this option resolves the Finder alias and the contents of name1 overwrite the file that the Finder alias references.

-y

Prevents the display of any confirmation dialog boxes by automatically responding Yes. This causes Move to overwrite any existing files or folders.

EXAMPLES

The following command line moves the four files from the current directory to the System Folder:

Move Startup Suspend Resume Quit "{SystemFolder}"

This command line moves File from the current directory to its parent directory:

Move File ::

The following command line moves File1 to File2, which is the same as renaming the file. Notice that because the -y option is specified, File2 is automatically overwritten if it exists.

Move -y File1 File2

SEE ALSO

Duplicate

Rename

 
 


Last Updated July 2000