Don't worry about it if you have a file and you want to rename it, just follow this logic to solve your problem.
- Get the file name and change it and save the change name in a string variable.
- Save the parent path of the source file.
- Move the file to another location with the change. Name get from String variable.
- Now move the file from a new location to its original location,
How to do it Programatically,
Entry global_file;//assign any file to it String FilePath=global_file.path; String parent_path=global_file.parentPath();//Keep parent path String ChanageName= "Your changed Name"; parent_path=parent_path+""+ChanageName; //setting path for renamed file to move to its original place. Entry RenamedFile = mApi.move(FilePath, "/"+ChanageName); //move to new place "/" Entry MoveRenameFile = mApi.move(RenamedFile.path,parent_path); //move to previous location
Pir fahim shah
source share