File.move

Tries to move the file or directory source to the location specified by destination. If native move operations are supported then this is used, otherwise a copy + delete fallback is used. The native implementation may support moving directories (for instance on moves inside the same filesystem), but the fallback code does not.

If the flag gio.types.FileCopyFlags.Overwrite is specified an already existing destination file is overwritten.

If cancellable is not null, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error gio.types.IOErrorEnum.Cancelled will be returned.

If progress_callback is not null, then the operation can be monitored by setting this to a #GFileProgressCallback function. progress_callback_data will be passed to this function. It is guaranteed that this callback will be called after all data has been transferred with the total number of bytes copied during the operation.

If the source file does not exist, then the gio.types.IOErrorEnum.NotFound error is returned, independent on the status of the destination.

If gio.types.FileCopyFlags.Overwrite is not specified and the target exists, then the error gio.types.IOErrorEnum.Exists is returned.

If trying to overwrite a file over a directory, the gio.types.IOErrorEnum.IsDirectory error is returned. If trying to overwrite a directory with a directory the gio.types.IOErrorEnum.WouldMerge error is returned.

If the source is a directory and the target does not exist, or gio.types.FileCopyFlags.Overwrite is specified and the target is a file, then the gio.types.IOErrorEnum.WouldRecurse error may be returned (if the native move operation isn't available).

Parameters

destination gio.file.File

#GFile pointing to the destination location

flags gio.types.FileCopyFlags

set of #GFileCopyFlags

cancellable gio.cancellable.Cancellable

optional #GCancellable object, null to ignore

progressCallback gio.types.FileProgressCallback

#GFileProgressCallback function for updates

Return Value

Type: bool

true on successful move, false otherwise.