• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 537
  • Last Modified:

Renaming the existing folder name in air application

Hi,

Can u let me know how to rename the folder name from within air application in flex4.................................



Thanks & Regards
0
SreeramojuPradeep
Asked:
SreeramojuPradeep
  • 2
1 Solution
 
dgofmanCommented:
var sourceFolder:File = File.applicationStorageDirectory.resolvePath("Test");
if(!sourceFolder.exists)
      sourceFolder.createDirectory();
trace(sourceFolder.nativePath);
try  
{
      var destinationFolder:File= File.applicationStorageDirectory.resolvePath("Test2");
      sourceFolder.moveTo(destinationFolder, true);
      trace(destinationFolder.nativePath);
}
catch (error:Error)
{
      trace("Error:" + error.message);
}
0
 
SreeramojuPradeepAuthor Commented:
U mean renaming the folder or file is not possible...but instead we can use moveTo by deleting the previous folder....
0
 
dgofmanCommented:
Please read documentation of File class

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/filesystem/File.html

"To rename a file, set the destination parameter to point to a path that is in the file's directory, but with a different filename."
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get Certified for a Job in Cybersecurity

Want an exciting career in an emerging field? Earn your MS in Cybersecurity and get certified in ethical hacking or computer forensic investigation. WGU’s MSCSIA degree program was designed to meet the most recent U.S. Department of Homeland Security (DHS) and NSA guidelines.  

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now