Description

This function renames a file.

Examples




$cpanel = new CPANEL(); // Connect to cPanel - only do this once.
$rename_file = $cpanel->api1(Fileman, 'fmrename', array('public_html', 'myfile.txt', 'otherfile.txt', '1')); // Call the function.



my $cpliveapi = Cpanel::LiveAPI->new(); # Connect to cPanel - only do this once.
my $rename_file = $cpliveapi->api1(Fileman, 'fmrename' ['public_html', 'myfile.txt', 'otherfile.txt', '1']); # Call the function.


<cpanel Module="Fileman::fmrename ( $FORM('dir','file','filename','doubledecode'))">




cpapi1 --user=username Fileman fmrename public_html myfile.txt otherfile.txt 1



Renamed test.txt -> newname.txt




Parameters

ParameterTypeDescriptionPossible valuesExample
dirstring

Required

The file's directory.

Any valid directory name.public_html
filestring

Required

The file to rename.

Any valid file name.myfile.txt
filenewstring

Required

The file's new name.

The file's new name.newfile
doubledecodeBoolean

Required

Whether to decode the dir and file parameters' URI values.

  • 0 – Do not decode.
  • 1 – Decode.
1

Returns

This function returns a message of success with the file's old and new name.