2013-11-21 1 views
0

"sdcard/XYZ_APP/images /"폴더 내의 이름을 바꾸고 싶습니다. "images"폴더 안에있는 모든 이미지가 포함되어 있습니다. "mnt/sdcard/XYZ_APP/.images/.."와 같이 "images"폴더의 이름을 ".images"로 바꾸고 싶습니다. 어떻게 자바 스크립트를 사용하여 Android Worklight에서 할 수 있습니까? 나는 아래 코드를 시도했지만 내 code.please에 뭔가 잘못된 것이 있는지 확인 이것을 검토하십시오.Sdcard에서 이름 바꾸기 디렉토리 : Android Worklight

function renamefile(){ 

var entry="sdcard/LMS_APP/images"; 
    DirectoryEntry Entry = new DirectoryEntry({fullPath: entry}); 
var parent = "sdcard/LMS_APP/"; 
DirectoryEntry parentEntry = new DirectoryEntry({fullPath: parent}); 
// move the file to a new directory and rename it 
    Entry.moveTo(parentEntry, ".images", success, fail); 

}

답변

1

이 코드 조각은 그래서,이 라인에 뭔가를하려고 나를

/* Move /sdcard/Songs to /sdcard/Songs123 */ 
function renamefile(){ 
    var from = new DirectoryEntry("Songs", "/sdcard/Songs"); 
var to = new DirectoryEntry("Songs123", "/sdcard"); 
from.moveTo(to, "Songs123", success, failure); 
} 

작동

function renamefile(){ 
    var from = new DirectoryEntry("images", "/sdcard/LMS_APP/images"); 
    var to = new DirectoryEntry(".images", "/sdcard/LMS_APP"); 
    from.moveTo(to, ".images", success, failure); 
} 
관련 문제