How to do Rename file and Rebuild JS Grouping at SugarOnDemand

Hello Folks

How to rename the file before installing the addon at Sugar on Demand.

And Also Rebuild JS Grouping Files using coding.

I have tried using $uploadFile->duplicate_file But not working.


if (SugarAutoloader::fileExists("custom/modules/EmailTemplates/DetailView.html"))
echo "Yes";

$uploadFile = new UploadFile();

$file = "custom/modules/EmailTemplates/DetailView.html";
$newfile = 'custom/modules/EmailTemplates/DetailView_bkp_'.time().'.html';

$uploadFile->duplicate_file($file, $newfile);

echo "No";

Please let me know how i can do ?

André Lopes Francesca Shiekh Matt Marum Alex Nassi