Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove windows file readonly attribute in gulp file

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

like image 737
Souvik Basu Avatar asked Oct 22 '25 04:10

Souvik Basu


2 Answers

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");
});
like image 97
Souvik Basu Avatar answered Oct 24 '25 22:10

Souvik Basu


I ended up solving this problem with gulp-chmod.

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

like image 36
Mike Cheel Avatar answered Oct 24 '25 21:10

Mike Cheel



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!