31
votes
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 ...
21
votes
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 ...
20
votes
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 ...
18
votes
What secrets are hidden away in your init.m and where do you place it? Please help me build the ideal init.m
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 ...
Community wiki
17
votes
Accepted
17
votes
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).
...
16
votes
Can Mathematica edit large binary files in-place?
We can do it straightforward in Java using JLink:
...
15
votes
Better random (unique) file name
It might be best to use CreateUUID.
CreateUUID[]
"73ccc27c-687f-4eca-8214-ceeb8a8b7773"
...
13
votes
Accepted
13
votes
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 ...
12
votes
Argument completions for user-defined functions
This can be accomplished with the AddCodeCompletion function in the function repository.
Evaluate the following piece of code:
...
12
votes
12
votes
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 ...
12
votes
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
...
12
votes
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:
...
11
votes
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 ...
11
votes
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.
...

Kuba♦
- 136k
11
votes
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 ...
11
votes
What secrets are hidden away in your init.m and where do you place it? Please help me build the ideal init.m
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 ...
Community wiki
10
votes
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
...
10
votes
Can I get a list of more than fifteen of the most recent notebooks opened?
As commented by J. M. you can persistently increase the menu size with:
SetOptions[$FrontEnd, "NotebooksMenuHistoryLength" -> 20] (* 20 is arbitrary *)
You ...
10
votes
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 ...
10
votes
Accepted
Renaming Files with Mathematica
The following method does not require a specific fixed number of digits in the start of file name and does not depend on specific fixed non-numeric separator such as "-".
...
10
votes
Accepted
How to zip folders
This can be achieved with Map (/@).
1) Identify the folders you want to compress:
...
9
votes
Accepted
How to make a better `Sort` in my case
How about this one?:
SortBy[#, FileBaseName] &@fileNames
9
votes
Get n filenames in a directory?
Using OS shells commands seems to be much faster, although their output will need some massaging to obtain only the file names.
For instance, the following works quite well on my system (Win7-64):
<...
9
votes
Accepted
What's the fastest way to read a simple numerical list?
Your real problem is
I have a large .txt file
In a txt file, each number is represented by a sequence of bytes with possibly varying length followed by a ...
9
votes
Opening Mathematica file in Google drive
There is now a Chrome app for opening Wolfram notebooks in Wolfram Cloud.
Once you've installed the app, you can visit your Google Drive on the web and double-click to open a notebook file. You'll ...
9
votes
Accepted
Find image dimensions without importing the full image?
The documentation says how to do this.
Import["image.jpg", "ImageSize"] // AbsoluteTiming
{0.052691, {2048, 1366}}
9
votes
Accepted
How to follow symbolic links on disk?
AbsoluteFileName will resolve symbolic links.
Example on my machine:
...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
files-and-directories × 482import × 65
export × 53
notebooks × 34
front-end × 29
string-manipulation × 25
windows × 23
list-manipulation × 18
save × 16
performance-tuning × 13
packages × 13
scripting × 13
bugs × 12
output-formatting × 12
functions × 11
image × 10
warning-messages × 9
wolfram-cloud × 9
text × 9
file-transfer × 9
mac-os-x × 8
streams × 8
web-access × 7
external-calls × 7
binary × 7