Rename a folder/File

Showing results for 
Search instead for 
Did you mean: 

Rename a folder/File

Established Member
0 0 1,466

Web script to rename a folder or a file in alfresco:

Arguments to script: alfresco ID(dir) and New name(rename_to) of the folder/file

Create 3 files in Data Dictionary/Web Scripts/

  • changeName.get.desc.xml 

<?xml version="1.0" encoding="UTF-8"?>
   <description>Rename folder or file</description>

  •  changeName.get.html


  • changeName.get.js

var docNodeId = args.dir;
var newName = args.rename_to
function main()
   if((docNodeId != "") && (docNodeId != null))
      var docNode = search.findNode("workspace://SpacesStore/"+docNodeId); = newName
      status.setCode(404,"File name missing in the call");

Refresh Web scripts.

Usage : https://<domain name>/alfresco/s/changename?dir=2e36b38b-0af9-4973-a7a4-e01869b0722c&rename_to=test