<?xml version="1.0" encoding="UTF-8"?>
<!--
 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
 * Copyright (C) 2009 - DIGITEO - Allan CORNET
 *
 * Copyright (C) 2012 - 2016 - Scilab Enterprises
 *
 * This file is hereby licensed under the terms of the GNU GPL v2.0,
 * pursuant to article 5.3.4 of the CeCILL v.2.1.
 * This file was originally licensed under the terms of the CeCILL v2.1,
 * and continues to be available under such terms.
 * For more information, see the COPYING file which you should have received
 * along with this program.
 *
 -->
<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns3="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="movefile" xml:lang="en">
    <refnamediv>
        <refname>movefile</refname>
        <refpurpose>moves file or directory</refpurpose>
    </refnamediv>
    <refsynopsisdiv>
        <title>Syntax</title>
        <synopsis>movefile(source, destination)
            [status, message] = movefile(source, destination)
        </synopsis>
    </refsynopsisdiv>
    <refsection>
        <title>Arguments</title>
        <variablelist>
            <varlistentry>
                <term>source</term>
                <listitem>
                    <para>
                        a character string.
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>destination</term>
                <listitem>
                    <para>
                        a character string.
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>status</term>
                <listitem>
                    <para>
                        an integer: the status of the operation.
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>message</term>
                <listitem>
                    <para>
                        a character string: a message about an error.
                    </para>
                </listitem>
            </varlistentry>
        </variablelist>
    </refsection>

    <refsection>
        <title>Description</title>
        <para>
            <code>movefile(source, destination)</code> moves the file or directory
            <varname>source</varname> (and subdirectories) to the file or directory
            <varname>destination</varname>.
        </para>
        <para>
            If <varname>source</varname> is a directory, <varname>destination</varname> cannot be a file.
            <warning>
                <function>movefile</function> replaces existing files without
                warning.
            </warning>
        </para>
        <para>
            <code>[status, message] = movefile(source, destination)</code> moves <varname>source</varname> to <varname>destination</varname>, returning the <varname>status</varname> and a <varname>message</varname>.
        </para>
        <para>
            Whatever the operating system, if the move succeeds, the
            <varname>status</varname> is 1 and the <varname>message</varname> is
            empty; if the move fails, the <varname>status</varname> is 0 and the
            <varname>message</varname> is not empty.
        </para>
    </refsection>
    <refsection>
        <title>Examples</title>
        <programlisting role="example"><![CDATA[
      copyfile(SCI+"/etc/scilab.start",TMPDIR+"/scilab.start")
      [status,message] = movefile(TMPDIR+"/scilab.start",TMPDIR+"/renamed_scilab.start")
    ]]></programlisting>
    </refsection>
    <refsection role="see also">
        <title>See also</title>
        <simplelist type="inline">
            <member>
                <link linkend="copyfile">copyfile</link>
            </member>
        </simplelist>
    </refsection>
</refentry>
