Remove windows file readonly attribute in gulp file

心已入冬 提交于 2019-12-07 15:46:43

问题


How can we remove readonly attribute from all files under a folder in Windows?

UPDATE: The question is more about how to remove readonly attribute using gulpfile


回答1:


I figured out the answer:

To remove readonly attribute of all files under a directory recursively, we run the following command in windows Command line

attrib -r <dir-name>\*.* /s

Following gulp task removes readonly attribute of all files under

gulp.task('remove-readonly-attributes', function() {
    require("child_process").exec("attrib -r <dir-name>\*.* /s");
});



回答2:


I ended up solving this problem with gulp-chmod.

https://www.npmjs.com/package/gulp-chmod



来源:https://stackoverflow.com/questions/29483772/remove-windows-file-readonly-attribute-in-gulp-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!