MOVEFILE

Purpose:

Moves one or more files to a destination file or directory.

Syntax: 

MOVEFILE("srcname", "desname", overwrite)

"srcname"

-

A string, the name of the file or directory to copy. The name can include * or ? wildcard characters.

"desname"

-

A string, the name of the destination file or directory.

confirm

-

Optional, an integer confirm overwrite flag.

0:

Overwrite without confirmation (default).

1:

Confirm overwrite

2:

Do not overwrite

Returns:

The count of the number of files successfully moved.

Example:

movefile("myfun.spl", "myfun.spl.bak")

 

moves the file myfun.spl to myfun.spl.bak in the current directory. myfile.spl.bak is overwritten if it already exists. The original file myfun.spl is removed.

Example:

movefile("\spldir\*.spl", "E:\splbackup")

 

copies all files with extension .spl in the directory \spldir to the directory E:\splbackup. The original files are removed from the source directory. The number of files copied is returned.

Example:

movefile("\spldir", "E:\splbackup")

 

moves all files and sub-directories in the directory \spldir to the directory E:\splbackup. The directory \spldir is removed. The number of files copied is returned.

Remarks:

MOVEFILE moves a source file to a destination file or directory. If the source is a directory or resolves to multiple files, the target must also be a directory. The original files or directory are removed.

 

If the source name specifies a directory, all of the files and sub-directories are moved to the target directory.

 

The source name may contain the * and ? characters to specify multiple files.

 

See COPYFILE to copy one more source files or a directory without deleting the original files.

See Also:

COPYFILE

DELFILE

FILEEXISTS

MKDIR

RMDIR