MATLAB Answers


How to create folder using mkdir with permissions to write?

Asked by Kelly Kyriakou on 29 Nov 2016
Latest activity Answered by Jan
on 29 Nov 2016
I created a folder using "mkdir", however I can't write files at this folder because the I don't have the permission, the folder is only for read. How to create folder with permission to write?


Not sure if this helps since I never had this issue when creating new folders, but you could maybe check out fileattrib.
I used fileattrib('D:\work\results','+w') but nothing changed, the folder is still for read only

Sign in to comment.

1 Answer

Answer by Jan
on 29 Nov 2016

When you use fileattrib, catch the success and the error message also:
[status,msg,msgID] = fileattrib('D:\work\results','+w')
What do you get? You cannot change the permissions of a folder, if you do not have write permissions to it. Actually you should not even be able to create a folder without write permissions. So how did you create it at first?
Will the problem occur repeatedly? If not, use the Security tab in the "Properties" of the folder, which appears in its context menu in the Windows Explorer. Perhaps the permissions of D:\Work are restricted already. Then fix this folder also.


Sign in to comment.