# Prevent 10.2 from creating “Wolfram Mathematica” directory on Linux

Since upgrading to version 10.2.0.0, every time I start the Mathematica front-end it creates a "Wolfram Mathematica" directory under my home directory. (It never seems to put anything in it.) Anybody know how to prevent this behaviour?

The "Wolfram Mathematica" directory is created automatically by the front-end and is located in $UserDocumentsDirectory. It is the default directory to save new documents in and also is on TrustedPath. The typical location for Linux systems is $HOME/Documents, however it may happen to fall back on $HOME depending on the Xdg user directories setting. This can be changed by xdg-user-dirs-update --set DOCUMENTS AnyDesiredDirectory which can prevent the home directory cluttering behavior by using another location. • Thanks for the information. I take it this means I can't prevent it? For now I've just put a RemoveDirectory in my init.m – Matt Pusey Jul 28 '15 at 23:31 • @Matt Correct, no way to prevent the creation of that directory, but it is possible to change its location in case the home directory is objectionable. – ilian Jul 28 '15 at 23:37 • Is this the intended behavior? Or is this faulty behavior? I don't really like a "Wolfram Mathematica" directory under my ~/Documents directory. – Andreas Lauschke Aug 10 '15 at 14:32 • @Andreas It is the intended behavior. Personally I think users should have more control over this -- I would recommend sending feedback to support so they can file a formal suggestion on your behalf. – ilian Aug 10 '15 at 15:47 • @nix On OS X the location is determined by querying for NSDocumentsDirectory via the NSSystemDirectories API, I am not sure if the operating system allows users to override this in any way. – ilian Sep 27 '15 at 16:43 Indeed this is annoying. In my ~/.Mathematica/Kernel/init.m I have placed this removal code: With[{dir =$UserDocumentsDirectory <> "/Wolfram Mathematica"},
If[DirectoryQ[dir], DeleteDirectory[dir]]
]

• Instead of adding "Documents" manually to the path (if necessary), replace $HomeDirectory with $UserDocumentsDirectory. – Casimir Aug 24 '17 at 11:15

I ended up following the last solution suggested, that is, deleting the folder in the init file. Although it required a few minor modifications for it to work on Windows.

Specifically, Mathematica 11 on Windows 7 creates the folder MyDocuments\Wolfram Mathematica each time it starts, and I couldn't find a user-friendly way to modify or prevent this through the GUI in Preferences, which annoys the hell out of me.

As a simple workaround for Windows, consider editing

C:\ProgramData\Mathematica\Kernel\init.m

With[{dir = $UserDocumentsDirectory <> "\\Wolfram Mathematica"}, If[DirectoryQ[dir], DeleteDirectory[dir]]]  to delete it automatically. Note the DOUBLE backslash as folder separator. Alternatively, use FileNameJoin. Thanks to Darko Veberic for the suggestion. • Instead of double (back-)slashes you could also use FileNameJoin[{$UserDocumentsDirectory, "Wolfram Mathematica"}], which would pick the backslash automatically on Windows. – Ruslan Jan 29 '17 at 12:34