Copy and re-name a file on android
I have a file which I am using as a temporary file until the user开发者_如何学编程 selects to save this file, How do I go about making a copy of this file but at the same time re-naming it. Example below:
File 1:
/sdcard/Folder/file1.wav
File 2:
Copy of file 1, renamed to file2.wav in /sdcard/Folder/file2.wav
I understand using Environment.getExternalStorageDirectory().getAbsolutePath()
gets me the path to the external storage so i'm not asking how I get to the sdcard or whatever. just to make a copy of a file and re-name it.
Try Apache Commons IO FileUtils.moveFile(File, File).
精彩评论