3

I use Windows and every time I open Mathematica it creates a "Wolfram Mathematica" directory under my documents, which I don't want. My first choice would be to prevent Mathematica from even creating that directory, but I believe that is not possible. So my second choice is to move it somewhere else. I have researched this and tried several things but I still cannot do it.

I believe the location of that directory could be controlled by either \$UserDocumentsDirectory or NotebookBrowseDirectory. If it is $UserDocumentsDirectory then I'm not sure how to permanently change the value of this. If it is NotebookBrowseDirectory then I think the way to change it is with the Options Inspector. However, within the Options Inspector all values are grayed out when the scope is set to either Selection or Selected Notebook. I can only make changes when the scope is set to Global Preferences, and when I do change NotebookBrowseDirectory with that setting it doesn't do what I want. So if NotebookBrowseDirectory is indeed what controls the location of that directory it must need to be set under Selection or Selected Notebook, which I cannot do.

Not sure if this is significant, but the example given on this page fails for me https://reference.wolfram.com/language/tutorial/ManipulatingNotebooks.html#3080.
When I input Options[$FrontEnd, NotebookBrowseDirectory] it returns the error Options::optnf: NotebookBrowseDirectory is not a known option for FrontEndObject. That page doesn't say what version of Mathematica it applies to. I am using 12.0, but that page looks recent enough to cover that. So that's another mystery.

Can someone tell me how to permanently move the Wolfram Mathematica directory?

Isoar
  • 31
  • 2
  • Welcome to Mathematica.SE! I hope you will become a regular contributor. To get started, 1) take the introductory [tour] now, 2) when you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge, 3) remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign, and 4) give help too, by answering questions in your areas of expertise. – bbgodfrey Nov 24 '21 at 13:24
  • I got Options[$FrontEnd, NotebookBrowseDirectory] to work by enclosing NotebookBrowseDirectory in quotes: Options[$FrontEnd, "NotebookBrowseDirectory"]. Which is strange because Options[$FrontEnd, NotebookPath] and others work just fine without quotes. – Isoar Nov 24 '21 at 18:00
  • I have determined that upon startup Mathematica queries the value of HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\Personal and assigns it to $UserDocumentsDirectory. That is the directory under which it creates "Wolfram Mathematica". I cannot permanently change that registry key value because that would just change the location of my documents, and the whole point is to keep "Wolfram Mathematica" out of my documents. So I think what I need to do is somehow change the value of $UserDocumentsDirectory before "Wolfram Mathematica" gets created. – Isoar Nov 25 '21 at 00:35
  • I don't understand why you object to the existence of that directory. There are no files associated with it and so it seems harmless to me. Other software create their own directory in Documents with no files also. – Somos Nov 25 '21 at 04:13
  • Because my Documents directory is my documents directory. I am very particular about my directory structure. It is extremely annoying that every time I run Mathematica that empty folder shows up again and I have to delete it, over and over. Other software does use the Documents folder by default, but I've never run across one that couldn't be redirected to somewhere else by configuration. Then it is only a one time inconvenience, not ongoing like this. – Isoar Nov 25 '21 at 09:03
  • 1
    This is something best suited to submit to wolfram technical support. I might even suggest filing a bugs report in reference to the linked documentation page. – CA Trevillian Nov 25 '21 at 18:08
  • Because it is risky, I would never recommend you to add DeleteDirectory[ FileNameJoin[{$UserDocumentsDirectory, "Wolfram Mathematica"}], DeleteContents -> True] to your init.m file – Gustavo Delfino Nov 25 '21 at 21:19
  • Very nice work around. While not the ideal solution that I would like it, might save me a lot of messing around. – Isoar Nov 27 '21 at 18:11
  • Unfortunately that doesn't work either. Mathematica seems to delete init.m when this line is in it, which results in having to reinitialize all your settings, which recreates init.m without the new line in it, so you are right back where you started. You can set init.m to read only so it doesn't get reset, but then you still have to go through all the initialization steps every time you start Mathematica, which is even more annoying than having to delete "Wolfram Mathematica" every time. – Isoar Nov 28 '21 at 07:56

1 Answers1

0

You can change the directory in each document for imports or exports:

SetDirectory["H:\\My Documents\\..."]
Philipp
  • 173
  • 6
  • I had tried that but it doesn't change the location of "Wolfram Mathematica" the next time you start it. – Isoar Nov 24 '21 at 15:59