【问题标题】:chrome filesystem - rename a directorychrome文件系统 - 重命名目录
【发布时间】:2015-09-16 17:28:09
【问题描述】:

在新的 chrome 文件系统 api 中,如何重命名目录?

目录本身的

moveTo() 似乎不起作用,我不想遍历目录中的所有文件。

有没有简单的方法来重命名它? 谢谢!

【问题讨论】:

    标签: javascript google-chrome html5-filesystem


    【解决方案1】:

    这对我有用,你能提供更多关于你遇到什么样的错误的信息吗?

    我们直接从条目中获取父级,只需将具有新名称的文件夹放在同一个父级下。

    请注意,如果新名称与旧名称相同,即使您更改名称中的大写字母,这也会失败,并出现无效修改错误。

    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" )
    

    【讨论】:

      猜你喜欢
      • 2020-11-20
      • 2015-10-08
      • 2013-07-30
      • 1970-01-01
      • 1970-01-01
      • 2012-03-03
      • 2013-12-05
      • 2022-01-22
      • 1970-01-01
      相关资源
      最近更新 更多