Child pages
  • cPanel API 1 Functions - Fileman::fmrename

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Description

Excerpt

This function renames a file.

Include Page
LIB:_cPanelAPI1NoEquivalent
LIB:_cPanelAPI1NoEquivalent

Multiexcerpt include
SpaceWithExcerptcom.atlassian.confluence.content.render.xhtml.model.resource.identifiers.SpaceResourceIdentifier@12665
MultiExcerptNameAPIDisabledFileStorageRole
PageWithExcerptLIB:_ServerRoleDisabledAPI

Panel
bgColor#F2F2F2
borderStylenone

Examples


Panel
bgColor#FFFFFF
borderStylenone


Expand
titleLiveAPI PHP Class


Code Block
languagephp
linenumberstrue
$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.

Include Page
LIB:_LiveAPIPHPLink
LIB:_LiveAPIPHPLink


Expand
titleLiveAPI Perl Module


Code Block
languageperl
linenumberstrue
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.

Include Page
LIB:_LiveAPIPerlLink
LIB:_LiveAPIPerlLink


Expand
titlecPanel Tag System (deprecated)

Include Page
LIB:_cPanelTagsWarning
LIB:_cPanelTagsWarning

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



Expand
titleCommand Line


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

Include Page
LIB:_cPanelAPI1CLINote
LIB:_cPanelAPI1CLINote


Expand
titleOutput (plaintext)


Code Block
languagetext
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.