title: Stata can't open file saved in local cloud storage folder on Mac
body: <p>I am using Stata on a Mac. I updated the OS to Monterey today. If I try to open a .dta file---that is saved on my local computer in a folder that syncs to OneDrive---from code in the Do File Editor/Command prompt (where I refer to the file using its full file path), it doesn't open. The error is r(601) - File ... cannot be found.</p>
  <p>But if I click on it in Finder, it opens in Stata just fine. After I have done this, I can then open this file in Stata by running the exact same Stata code that didn't work before. Somehow it seems like Stata can't see the file/folder initially, but then it can. I am not sure if this has to do with the OneDrive file/folder permissions or something else.</p>
  <p>If, in Stata, I change the directory to the correct directory using <code>cd</code> and then load the file (without referring to the path), it works. However, I would like to be able to refer to the file using the entire file path and not have to change the directory each time.</p>
  <p>Interestingly, if I change the directory to the correct directory <em><strong>using <code>Change working directory</code> in the <code>File</code> drop down</strong></em> and then try to load the file using the file path, it also works. But if I do not do the drop down and write out the <code>cd</code> using code, and try accessing the file using the path it doesn't work!</p>
  <p>Somehow Stata has to initially &quot;see&quot;/&quot;access&quot; the correct folder (in a very particular way) before being able to access it with the file path. Very strange. (Just to be clear, if I do not change the directory to the correct directory and then try to load the file using its file path, it doesn't work.)</p>
  <p>I also tried creating a file using <code>texdoc init...</code> (in a folder that already exists, but that has not been used by Stata before) and get this error:</p>
  <pre><code>could not create directory .....
                   mkdir():   693  could not create directory
            texdoc_mkdir():     -  function returned error
             texdoc_init():     -  function returned error
                   &lt;istmt&gt;:     -  function returned error
  </code></pre>
  <p>I do not get this error if I instead use another folder in the same directory that I have previously used.</p>
  <p>I think that the error I am encountering is the same or similar to this one (with no acceptable answer): <a href="https://answers.microsoft.com/en-us/msoffice/forum/all/onedrive-folder-doesnt-exist/e6b97d47-3f6a-4863-bf68-d3a02832f2bb" rel="nofollow noreferrer">https://answers.microsoft.com/en-us/msoffice/forum/all/onedrive-folder-doesnt-exist/e6b97d47-3f6a-4863-bf68-d3a02832f2bb</a></p>