【问题标题】:Copy an entire directory复制整个目录
【发布时间】:2016-04-07 20:44:19
【问题描述】:

我正在尝试复制一个文件夹及其所有子文件夹。

copy:{
        test:{
            files:[
                { 
                    src: '/static/**',
                    dest: '/test/'
                }
              ]
        }
}

我得到错误:

无法创建目录“/static”(错误代码:EACCES)。

我哪里出错了?

【问题讨论】:

    标签: javascript gruntjs grunt-contrib-copy


    【解决方案1】:

    改到下面试试这个。

    copy:{
            test:{
                files:[
                    { 
                        src:['static/**'],
                        dest: 'test/'
                    }
                  ]
            }
    }
    

    files: [
      { src: 'static/**', dest: 'test/' }
    ]
    

    【讨论】:

    • 这输出:'创建了 2 个目录,复制了 14 个文件',但我找不到测试目录 - 它应该与 grunt 文件的位置有关?
    • expand: true, cwd: 'your-starting-directory/', 然后是files。应该像魅力一样工作。
    • @suzumakes:如果需要,可以使用 expand:true 选项...
    • expand true 有什么作用?
    • 这将帮助您...gruntjs.com/… 并查看 cwd、src 和 dest... 当 expand 设置为 true 时。
    猜你喜欢
    • 2011-09-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-04-19
    • 1970-01-01
    • 2013-10-10
    • 1970-01-01
    相关资源
    最近更新 更多