Move (Rename) files

Namespace: Perforce.P4
Assembly: p4api.net (in p4api.net.dll) Version: 2017.3.160.836 (2017.3.160.0836)

Syntax

C#
public IList<FileSpec> MoveFiles(
	FileSpec fromFile,
	FileSpec toFile,
	Options options
)
Visual Basic
Public Function MoveFiles ( _
	fromFile As FileSpec, _
	toFile As FileSpec, _
	options As Options _
) As IList(Of FileSpec)
Visual C++
public:
IList<FileSpec^>^ MoveFiles(
	FileSpec^ fromFile, 
	FileSpec^ toFile, 
	Options^ options
)

Parameters

fromFile
Type: Perforce.P4..::..FileSpec
Original name
toFile
Type: Perforce.P4..::..FileSpec
New name
options
Type: Perforce.P4..::..Options
options/flags

Return Value

List of files moved

Remarks


p4 help move

move -- move file(s) from one location to another
rename -- synonym for 'move'

p4 move [-c changelist#] [-f -n -k] [-t filetype] fromFile toFile

Move takes an already opened file and moves it from one client
location to another, reopening it as a pending depot move. When
the file is submitted with 'p4 submit', its depot file is moved
accordingly.

Wildcards in fromFile and toFile must match. The fromFile must be
a file open for add or edit.

'p4 opened' lists pending moves. 'p4 diff' can compare a moved
client file with its depot original, 'p4 sync' can schedule an
update of a moved file, and 'p4 resolve' can resolve the update.

A client file can be moved many times before it is submitted.
Moving a file back to its original location will undo a pending
move, leaving unsubmitted content intact. Using 'p4 revert'
undoes the move and reverts the unsubmitted content.

If -c changelist# is specified, the file is reopened in the
specified pending changelist as well as being moved.

The -f flag forces a move to an existing target file. The file
must be synced and not opened. The originating source file will
no longer be synced to the client.

If -t filetype is specified, the file is assigned that filetype.
If the filetype is a partial filetype, the partial filetype is
combined with the current filetype. See 'p4 help filetypes'.

The -n flag previews the operation without moving files.

The -k flag performs the rename on the server without modifying
client files. Use with caution, as an incorrect move can cause
discrepancies between the state of the client and the corresponding
server metadata.

The 'move' command requires a release 2009.1 or newer client. The
'-f' flag requires a 2010.1 client.

See Also