Tag Info

Argument completions for user-defined functions

Before you start using this, be aware that this is all undocumented and unsupported functionality. It may change at any time, it may crash Mathematica, and it may bite you when you least expect it. I ...
• 229k
Accepted

How to get the directory of a package?

FindFile will tell you which file will be loaded when you ask for a particular package with the backtick syntax. DirectoryName ...
• 229k
Accepted

Path Names Longer Than 256 on Windows

With a few rare exceptions, Mathematica is generally unable to work with long path names on Windows. This response presents two strategies to work around this difficulty: extended-length path syntax ...
• 67.6k

What is the difference between a .wl package and a .m package?

As after half a year there is still no answer, here are some very short answers from my comments: the difference is just the file ending as far as I know. if you have installed MATLAB (or another ...
• 23.2k
Accepted

...
• 229k

How to check whether a .txt file is empty

FileByteCount will give 0 for empty text files and is very fast (0.00003 seconds per file on my machine). ...
• 12.7k

I am an init.m ascetic. And I doubt after 30+ years of using Mathematica I will change. Everyone else, who wishes to, may proclaim how it is indispensable to their workflow, and I will accept their ...
Accepted

Relative Path in Mathematica

If you want to have the parent directory of the current directory, use ParentDirectory[]. The parent directory of your notebook can be found using: ...
• 64.8k

Can Mathematica edit large binary files in-place?

We can do it straightforward in Java using JLink: ...
• 6,298
Accepted

Prevent Export from overwriting files

Your basic requirement is met with: ...
• 266k

Better random (unique) file name

It might be best to use CreateUUID. CreateUUID[] "73ccc27c-687f-4eca-8214-ceeb8a8b7773" ...
• 33.7k
Accepted

\$Path hijacked by PacletManager?

Edit From version 9 PacletInfo.m file requires "Kernel" extension with Context ...
• 14.8k
Accepted

How to return notebook's own file name

You have to add a few extra commands to NotebookFileName to remove the directory. Last@FileNameSplit@NotebookFileName[] Hope ...
• 40.1k
Accepted

Making a Dataset that emulates ls -tlra?

Build your own Here I create a Dataset of files, taking advantage of the "Rules" option for ...
• 31.8k
Accepted

Searching a phrase in all *.nb files

Here is a way to search from within mathematica: ...
• 38.5k

Making a Dataset that emulates ls -tlra?

Try something like that ...
• 7,468

Implementing a Better Grep Command

Mathematica allows text searching using regular expressions (based on the PCRE library). It would take some work to re-implement the whole grep functionality within ...
• 60.5k

Wrong function of NotebookDirectory[] in the 12.1 version

This is a certainly a bug. The fix for it is going to be available in the next release (version 12.1.1). In the meantime, perhaps the following workaround code may help ...
• 25.2k
Accepted

How to determine the file type of a .m file?

It's somewhat of a meme that WL has a top-level function for everything, but it's kinda true: ...
• 19.5k

Argument completions for user-defined functions

This can be accomplished with the AddCodeCompletion function in the function repository. Evaluate the following piece of code: ...
• 69.1k

How to return notebook's own file name

No need to go through all the machinations of trimming/applying a cascade of functions, simply: CurrentValue["NotebookFileName"]
Accepted

Is there a predecessor to the new command CreateFile?

The new function CreateFile has two main tasks, CreateFile[] - will create a file in the "default area for temporary files on ...
• 64.8k

How can I get a FileNameSetter-like dialog inside my own custom dialog?

Not perfect but a good start. Openers expand/collapse trees but it does not affect the preview pane. Clicking on the directory name does. ...
• 134k

I tend to put a lot of little functions in my init.m file, functions that take arguments and use module variables. I found that I would now have Global symbols like ...

Error when implementing StartProcess[] in loops (Do, While, Table)

The problem is that the stdin stream for each process is being left open and needs to be closed. To demonstrate the issue, we create a single process: ...
• 67.6k
Accepted

why CopyFile cannot overwrite existing file?

Use the OverwriteTarget -> True option. Alas, this is not specified in the documentation. ?? CopyFile gives, among other ...
• 8,392
Accepted

how to get the size of a directory(total size of all files under this directory or its subdir or ...)

There is also a function in the Internal` context (for now) that does that ...
• 25.2k
Accepted

Obtain short path on Windows

Windows Command Line Here is a way using the Windows command line: getShortPathName[path_] := Import["!for %p in (\""~~path~~"\") do @echo %~sp", "Text"] So ...
• 67.6k

Opening Mathematica file in Google drive

If you have a public link, you can follow the answer to this question, and basically just import the data Import[url, "Data"] If you need to authenticate to get ...
• 31.8k