Questions tagged [files-and-directories]

Questions on obtaining files and directory structure/information and manipulating the said structure/information, searching/renaming particular files in a directory, etc., in an OS independent manner.

Filter by
Sorted by
Tagged with
0
votes
1answer
39 views

select partially matching filenames

I have two lists of files with slightly different naming conventions ...
1
vote
0answers
67 views

Mathematica crashed, now my file's all in text. How do I get it back to normal?

I was completing an assignment for a mathematica class, and ran a large set of data that crashed the program. I had to restart my computer, and when I relaunched mathematica, my file looks like this (...
1
vote
1answer
39 views

Import a file that is located in one of three directories?

Import a file that could be in one of three directories I want to import a file called image.png. I know it is either in dir1, <...
4
votes
1answer
87 views

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

Both Mathematica and MATLAB widely uses .m files, but with diametrically different syntaxes and usage. Currently WRI is moving towards the ...
1
vote
1answer
45 views

Import 4 data columns and drop one of them [closed]

I would like to import 4 columns of data from a Dat-file(Fortran) and then drop the fourth one to use ListPlot3D and repeat this to drop the third one. When I used ...
5
votes
1answer
129 views

Visualizing directories--a cleaner view of a helpful older post

I am looking to make graphics of a folder hierarchy, and this old post was very helpful. However, this method gives the whole file path for each node, which makes a complete mess in the directory I ...
0
votes
0answers
26 views

Using CloudDeploy[FormFunction[…]], how to let a user give a directory path as input?

I want to creat a CloudDeployed FormFunction which lets a user give the path to a directory on their local computer as an input. ...
2
votes
0answers
63 views

ResourceFunction cannot find cached local version

When I try to use ResourceFunction it doesn't find a file. I'm afraid it's because my user name on Windows include spaces and an "é". ...
0
votes
0answers
50 views

Why is my init.m not loading at startup?

The contents of init.m are placed inside an Initialization Cell so that some symbols are created in the Global` context and to prepend alternate paths to ...
1
vote
0answers
20 views

Getting the largest integer filename in a Wolfram cloud folder?

I'm creating a Wolfram function which saves PNGs into a cloud folder called png. I'd like this function to save pictures in increments, like ...
0
votes
1answer
42 views

Import and create a hexdump view of file

How would I go about creating a hexdump type of view of an imported binary file? for example, (format is ...
1
vote
2answers
86 views

Making a notebook unsavable, so that I don't accidentally mess up the code

I have an algorithm in a notebook that I don't want to change. I used it regularly. I'm afraid I might accidentally modify a parameter. I'd like the notebook to be executable, perhaps editable, but ...
1
vote
1answer
31 views

Reading specific data from files

I have a huge number of identically formatted .txt files. I would like to read some numbers at a specific position within the text file (row x, column y..) and put them in another file, then repeat ...
0
votes
1answer
53 views

File Name is incorrect in Directory [duplicate]

This is my test. x = 1.; file2 = "sqrt2_2b.txt"; Do[x = x/2 + 1/x; x >>> file2, {5}] This code above I get the File name "file2". ...
0
votes
1answer
40 views

How to load a function from an external notebook that creates a docked cells toolbar?

I coded a compact toolbar in its own file nbtaskmate.nb for various common notebook tasks which I would like to load onto any notebook I might have open with a ...
2
votes
0answers
46 views

What are key differences between InputNotebook and EvaluationNotebook?

I am still new to Mathematica but advancing to a point of programming notebook and cell manipulations using native commands. Sometimes they call for specifying ...
2
votes
2answers
118 views

Where to place the essential WSTP files in Visual Studio 2019?

I have Visual Studio for C installed in : C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC From https://reference.wolfram.com/language/tutorial/WSTPDeveloperGuide-Windows.html : "...
3
votes
2answers
105 views

How can I read this file?

I have to read and process a file that looks like this: ...
3
votes
1answer
95 views

Is there a more practical way to remove backgrounds from a list of files in a folder on my computer?

Is there a more practical way to remove backgrounds from a list of files in a folder on my computer? Example: Imagine a folder with three image files... Unfortunately I waste time manually renaming ...
1
vote
0answers
35 views

How to use export and schedule tasks to backup entire contents of an notebook at regular time intervals?

I am sorry I don't have any code to share so I would like your ideas. Although there is an AutoSave feature in Mathematica it lacks usefulness as it cannot be ...
2
votes
1answer
35 views

ResetDirectory causes a fail on stored file names

Consider some directory dir with sub dirs and files. Our aim is to count the no of files in dir (not in sub-dirs, just the dir.) ...
1
vote
0answers
31 views

How to test the existence of a file in a case-sensitive manner?

I noticed (using Mathematica 11.2 on Windows) that FileExistsQ["test.txt"] returns Trueeven if there only exists a ...
2
votes
1answer
88 views

How can I get rid of curly brackets writing minimization output to file [closed]

I have the following code ...
1
vote
0answers
8 views

Export function not working via JLink in Java8 compiled application

I have documented the following issue with evaluating the Export function via J/Link: https://stackoverflow.com/questions/63390977/wolfram-mathematica-kernellink-export-function-not-working-via-jlink-...
0
votes
0answers
24 views

Load binary .mx files from list of paths? [duplicate]

I have several .mx files containing data saved to disk via DumpSave. I load a list of these files in my folder as ...
2
votes
1answer
70 views

Efficiently check if a File object is a valid Image

I have a directory of images that might not have downloaded, and need to delete the duds. This is too slow: Import /* ImageQ /@ fileNames In bash, I use the ...
5
votes
1answer
83 views

FileNames becomes extremely slow when there are large number of files under a directory

I have a directory on my portable hard drive, with around 350000 files under it (there is no subdirectory, only files). I want to get all the file dirs so use ...
1
vote
1answer
85 views

How import Excel file from different folders

I would like to know how I can import excel files from inside different folders and save the results inside the associated folder. For example, the name of my folders are fn1={001, 002, 0045, 005, ...
0
votes
0answers
31 views

Expanding website file display ---------show files in full format

Many times looking for some material I find websites that seem to use a format that does not allow the file name to be fully visible. You download the file that you think it is and it turns out that ...
0
votes
1answer
74 views

Import and export a list of SparseArrays efficiently?

I have a list of integers dims and a list of SparseArrays bdrs (representing a chain complex ...
2
votes
1answer
110 views

Reading information from a Portable Executable (.exe)

I want to extract information from executable files, such as the names and sizes of sections, symbols, etc. The Wikipedia article has a diagram showing the layout of a PE. See also this diagram It ...
3
votes
3answers
132 views

How can I configure both Mathematica and the FrontEnd (whatever it is) to use the directory of the current notebook when saving/exporting graphics?

My system: Mathematica 11.2, Windows 10 Problem: I am (perpetually) working on my lecture notes, adding graphics produced by Mathematica. Obviously the notebooks I created for this purpose are in the ...
1
vote
0answers
29 views

linking to a cell in a Notebook from an outside program

In MS OneNote I can link to a Paragraph, so that when I open that link from an external program (like Windows Explorer), it'll tell OneNote to open itself and then open that Paragraph. I simply right-...
0
votes
0answers
55 views

Acessing data in google drive

I have a directory in Google Drive I would like to directly access and process data and save the outputs in the same drive. It is a personal drive. At first I thought would be so starigfhtforward as ...
2
votes
2answers
95 views

Is it possible for a Mathematica notebook to display its own metadata like last modified date and filename when opened?

Abstract: when managing hundreds of notebook files without a git system (version management) it would be very convenient to automatically show its own filename and last modified date at the top when ...
1
vote
0answers
28 views

NotebookDirectory in NotebookEvaluate

Suppose Notebook A calls NotebookEvaluate[Notebook B]. Notebook B calls NotebookDirectory[]. Naturally, NotebookDirectory[] returns the directory of Notebook B. Is there an option to have ...
2
votes
0answers
65 views

Error: “Cannot set current directory” if directory name starts with tilde “~”

On MacOS, there seems to be a bug in FileNames[] when a directory starts with a tilde ("~"). Does anyone else see this behavior?: ...
0
votes
1answer
64 views

How to resize a series of images to a given total file size while keeping their relative size?

I have multiple image files, file1.jpeg, file2.png, file3.gif, ..., whose sizes are 984KB, 10MB, 5.1MB, .... I'd like to resize them so Each image file, when open, have the same aspect ratio as the ...
1
vote
0answers
46 views

How to save a copy of the current notebook without opening it?

I want to save a copy of the current notebook using Mathematica code (* the notebook that's open is foo.nb *) NotebookSave[SelectedNotebook[], "bar.nb"] After ...
2
votes
0answers
17 views

Obtain “File Path Completion” with custom functions

Suppose I have a function like setDirectory[filePath_ : DirectoryQ] := SetDirectory[filePath] When I start to enter ...
3
votes
1answer
132 views

Incomplete path when using NotebookDirectory[] in ver 12.1.0 and Dropbox

I just upgraded from version 11.3.0 to version 12.1.0 and I am struggling with the directory of my .nb file. Usually I start all my .nb with ...
2
votes
1answer
56 views

TreeForm versus TreePlot conditional-tree-vertex-rendering

According to TreeForm documentation "TreeForm takes the same options as TreePlot". Now I tried to color TreeForm nodes differently. The TreePlot example from questions/99586 is working...: ...
4
votes
0answers
28 views

How to copy Mathematica settings from Linux to Windows

I have installed Mathematica both in Windows and in Linux. Can I copy the \$UserBaseDirectory folder in Linux (usually ~/.Mathematica) to the \$UserBaseDirectory in ...
2
votes
1answer
51 views

“Auto-loading” a .m file

I have a .m (say e.g. file1.m) file with various definitions that gets sourced by another notebook using the command Needs["file1`"]. If file1.m is in the ~/....
1
vote
1answer
89 views

Can't save output in the script mode

I encounter the problem that I can't save any output from Mathematica script. Here is a minimal example. test.m ...
4
votes
1answer
64 views

Get most recent file(s) in a directory?

FileNames retrieves a list of all files in a directory. But is there a way to order these files by their most recent modification time?
3
votes
0answers
36 views

Accessing a JPG file's properties on Windows

On Windows, a JPG file contains various properties (Title, Subject, Rating, Tags, Comments,...) that may be viewed and changed by right-clicking on the file in Explorer and selecting Properties, and ...
4
votes
0answers
60 views

Why is listing files on a network share so slow? / How to speed it up?

I'm using I need to load data in some files on a windows network share (samba), mounted on OSX. When listing the relevant directory in a shell, the performance is acceptable: ...
2
votes
1answer
70 views

Does any know how to get the paths of current opened locations in file explorer?

Does anyone know if there is a builtin way to get all opened locations in the file explorer? Like for browsers, the browser itself remembers the last opened locations. So even if it crashes one can ...
2
votes
0answers
38 views

Automatically additionally save a .pdf of every notebook saved as .nb

Is it possible to configure Mathematica to automatically save a .pdf of every notebook saved as .nb? If it matters: I am using Mathematica 11 on Windows 10.

1
2 3 4 5
9