movefile

Returns R after moving file(s) or directories from src to dst.

Syntax

R = movefile(src, dst)

[R, msg, id] = movefile (src, dst, 'f')

Inputs

src
Source file or directory which may contain wild cards.
Type: string
dst
Destination file or directory. If src represents multiple files, dst must be a valid directory.
Type: string
'f'
Force move flag which attempts to overwrite dst, if it exists.
Type: char | string

Outputs

R
1 on success and 0 on failure.
Type: integer
msg (optional)
System dependent message on failure.
Type: string
id (optional)
System dependent message ID on failure, or empty string on success.
Type: int | string

Examples

Successful move of a file to a destination directory:
R = movefile('foo.txt', 'c:\tests\A')
R = 1
Successful move of source name with a wild card and force copy option
[R, msg, id] = movefile('fo*.txt', 'c:\tests\', 'f')
R = 1
msg =
id = 
Unsuccessful move of a file, with a system message and ID:
[R, msg, id] = movefile('test3.txt', 'test4.txt')
R = 0
msg = No such file or directory
Copy failed from [foo.txt] to [c:\]
id = 2