【发布时间】:2015-09-16 17:28:09
【问题描述】:
在新的 chrome 文件系统 api 中,如何重命名目录?
目录本身的moveTo() 似乎不起作用,我不想遍历目录中的所有文件。
有没有简单的方法来重命名它? 谢谢!
【问题讨论】:
标签: javascript google-chrome html5-filesystem
在新的 chrome 文件系统 api 中,如何重命名目录?
目录本身的moveTo() 似乎不起作用,我不想遍历目录中的所有文件。
有没有简单的方法来重命名它? 谢谢!
【问题讨论】:
标签: javascript google-chrome html5-filesystem
这对我有用,你能提供更多关于你遇到什么样的错误的信息吗?
我们直接从条目中获取父级,只需将具有新名称的文件夹放在同一个父级下。
请注意,如果新名称与旧名称相同,即使您更改名称中的大写字母,这也会失败,并出现无效修改错误。
var test = function( entry, new_name ){
entry.getParent( function( parent ){
entry.moveTo( parent , new_name, function( new_node ){
console.log( new_node )
console.log( "Succes creating the new node" ) //We were able to rename the node
}, function( error ){
console.error( error )
console.error( "Something wrong when finding the parent" )
})
}, function( error ){
console.error( error )
console.error( "Something wrong when finding the parent" )
})
}
test( entry, "For the watch" )
【讨论】: