Skip to main content
calmchessplayer
Inspiring
June 23, 2009
Question

renameTo move file questions

  • June 23, 2009
  • 1 reply
  • 1213 views

I tried to use the following to rename and move a flv file to a diffrent folder but it doesn't work.....I tried several combinations but can't seem to figure out how to do it.....could you give me some examples plz.

fileObject3 = new File("streams/"+insID+"/"+stream+".flv");
fileObject3.renameTo("streams"/"adName"/"+adName+".flv");

    This topic has been closed for replies.

    1 reply

    June 23, 2009

    Looks like a syntax error.

    This line

    fileObject3.renameTo("streams"/"adName"/"+adName+".flv");

    looks like it wants to be

    fileObject3.renameTo("streams/"+adName+"/"+adName+".flv");

    If that's not the problem, try inspecting the info from the Application.onStatus event.

    I'm not sure if the renameTo method will create directories that don't exist. If that's the problem (Application.onStatus should tell you that), you can create the directory with the File class first, and then do your renameTo.

    calmchessplayer
    Inspiring
    June 23, 2009

    Wasn't a syntax error that was me makeing a hasty post and I already created the new directory that part works fine....i can also rename a file its moving one that the documentation says renameTO can do but i can't figure out how.

    calmchessplayer
    Inspiring
    June 23, 2009

    i settled for using copyTo and then remove instead of trying to move the file.