Skip to main content
Known Participant
May 31, 2014
Question

renaming a file with Server Side Actionscript on Linux

  • May 31, 2014
  • 1 reply
  • 473 views

I'm trying to use this function of Adobe Media Server's Server Side Actionscript to rename a file.

On Windows I can do `renameTo("/relative/path/object.ext")` and it'll work fine.

However, when running the server on Linux, it gives me an error, and the rename operation will fail.

So I'm thinking that it's a problem between what each OS considers to be a relative or absolute path.

But regardless, how can I rename a file using this command on Linux?

my current code is this

Client.prototype.doSave = function(oldName,newName){

var thumbName = newName.replace("vid_","thumb_");

  var oldSavedThumb = new File("/streams/_definst_/s3/"+thumbName+".png");

  if(oldSavedThumb.exists){

trace("saving over thumb");

oldSavedThumb.remove();

  } 


var thumb = new File("/streams/_definst_/"+thumbName+"_temp.png");


  if(thumb.exists){

if(!thumb.isOpen){

  thumb.renameTo("/streams/_definst_/s3/"+thumbName+".png");

  trace("thumb saved");

  }else{

trace('thumb is open');

  }

}else{

  trace('thumb does not exist');

}

}

I get an error at the thumb.renameTo line. It works on Windows, just not on Linux.

this thread seems to detail a similar problem, but I can't decipher what the solution actually is.

    This topic has been closed for replies.

    1 reply

    letsidc
    Participating Frequently
    June 3, 2014

    Dear sir or madam,

    Here is Letswin Technology, which specializes in global servers, web hosting, VPS, VPN. If anything I can do for you, pls contact us!

    Have a nice day!

    Known Participant
    June 3, 2014

    I have something you can do for me. You can answer the question that I asked.