FileMove

Moves files.

Syntax:

FileMove (source-list, destination, warning)

Parameters:

(s) source-list one or more filenames separated by a delimiter.

(s) destination target filename.

(i) warning @TRUE if you want a warning before overwriting existing files; @FALSE if no warning desired.

Returns:

(i) @TRUE if the file was moved. (see note).

 

Note: If warning parameter is set to @TRUE , then the return value will be @TRUE, even if it was modified by the user dialog.

Use this function to move an individual file, a group of files using wildcards, or several groups of files by separating the names with a delimiter.

You can move files to another drive. You can also move a file to a COM or LPT port, which would cause the file to be copied to the port and then deleted (do not put a colon after the name of the port).

Source-list and destination may contain * and ? wildcards.

Windows Vista/2008 and newer: This function may require an Administrator level account if dealing with files located in a protected directories: 'Program Files' and 'Windows'.

This function supports extended-length path names.

Examples:

;Example one
temp=Environment("TEMP")
DirChange(temp)
testfile="test.txt"
destination="C:\Backup"
If DirExist(destination)
   FileMove(testfile, destination, @FALSE)
   Message("FileMove","File Moved")
EndIf

 

;Example two
temp=Environment("TEMP")
DirChange(temp)
testfile1="test1.txt"
testfile2="test2.txt"
handle = FileOpen(testfile1, "write")
FileWrite(handle, "dummy data one")
FileClose(handle)
FileMove(testfile1, testfile2, @FALSE)
Message("FileMove","File Moved")

 

See Also:

FileAppend, FileCopy, FileDelete, FileExist, FileLocate, FileRename, IntControl 29, IntControl 30