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.

learn more… | top users | synonyms

4
votes
0answers
40 views

Can't get Mathematica to Import PDF files with diacritics on the file name

Tested with versions 9.0.0, 10.0.2 and 10.3.0, all under OS X 10.10.5. and Linux The ...
4
votes
1answer
85 views

depository/repository of Mathematica notebooks

Is there a depository/repository of Mathematica notebooks (not necessarily Mathematica packages) where one can upload some of their notebooks so as others can access them easily?
1
vote
3answers
61 views

How to make a list (of data points) whose name is the same as the file name from which the data is imported [duplicate]

I have a set of files, e.g. file1.dat, file2.dat,... containing data (list of data points to plot, manipulate...) I want to do the following ...
1
vote
2answers
111 views

Is there the possibility to write many times a value in definite list of file1.nb?

The commands testData = RandomReal[{0, 1}, {1, 1}]; Export["C:\\Users\\Alex\\Desktop\\1\\file1.nb", testData]; write the “testData” (value generated by ...
2
votes
2answers
75 views

How to separate the double columns while reading file

I have a file which has contents of the form 10533 "MENDOZAT " 115.0000 : 1 1.00000 Now I want to separate the words and get it as a list. like ...
0
votes
1answer
69 views

How to zip a folder? [duplicate]

This straightforward approach doesn't seem to work: In[42]:= cmd = StringSplit@"zip -r ~/data.zip ~/test/*" In[43]:= RunProcess@cmd Related: How can I ...
1
vote
1answer
35 views

Select folder with ChoiceDialog and return deepest folder name

For selecting a folder which contains data files I use the following code: ChoiceDialog[{FileNameSetter[Dynamic[dir], "Directory"], Dynamic[dir]}]; ...
1
vote
2answers
71 views

How to set the relative directory so that they work both in script and in notebook and portable?

Maybe the question is not clear, here I try to state it in more detail: I have a folder named project, for instance. In it I have two folders, one is named ...
1
vote
2answers
65 views

How do I set Mathematica to open a specific folder - When I type “Command + O” in OS X [closed]

When I type "Command + O", in Mac OSX 10, Mathematica automatically opens my directory: "Users/john" How can I change this setting to make it open "Users/john/Documents/Mathematica/GameOfLife" the ...
4
votes
3answers
137 views

How do I copy files to the clipboard?

Is there a way to mimic the Ctrl + V for a given file? I've got Mathematica to locate a certain file path, but I don't bother to copy the file in File Explorer (I will do this many times).
11
votes
2answers
3k views

How to place cdf file in Microsoft Word, Powerpoint or in interactive PDF file?

I would like to create a presentation for my lecture in which I would use Mathematica CDF files. Let's say I want to have such interactive content: ...
1
vote
1answer
53 views

How to export a list of numerical data to a file in the terminal?

I have a very simple program that export a list to a data file in table form. ...
10
votes
4answers
261 views

Handy / flexible directory tree operations

Is there any shorter / more handy / more flexible way to get directory tree as a nested Rules/Associations list? I tried to incorporate ...
6
votes
1answer
59 views

How do I directly read the Nth byte from a binary file?

I have a very large binary file (several hundred GB) which I would like to process using Mathematica. I only need to process a few bytes of this file at a time, and I know in advance which bytes I ...
1
vote
1answer
83 views

Using ReadList to import specific arrays of a multi-dimensional variable

Consider a large numerical variable (almost 1GB) which was constructed like below: output={scalar1,{Matrix1,Matrix2,Matrix3,scalar2}}; I used ...
1
vote
0answers
86 views

SemanticImport::unexpinvaliderr error when using trial version

I am trying to use SemanticImport for a personal experiment. I can correctly import a tsv file from a path, but if I change ...
2
votes
1answer
49 views

Get (<<) Evaluate File Name

This seems like a simple question due to lack of experience, but I can't seem to find an answer through searching. I am trying to read back a symbol from a ...
0
votes
0answers
80 views

Setting UserBaseDirectory for custom packages

Is there any reason to set $UserBaseDirectory to be anything other than the default? On my mac its set as ...
21
votes
0answers
400 views

A documented syntax of FileNames doesn't work?

Documentation discrepancy present through 10.3 According to the documentation for FileNames under Details: However when I attempt to use this syntax I get an ...
0
votes
1answer
74 views

How to fix backup command?

The following old code, from "Dr Bob" and Selwyn Hollis with a minor modification by me, produces a palette that allows one to create successive backups to the input notebook. But the code breaks in ...
2
votes
1answer
50 views

Where is ExampleData stored on my system

When I enter: Import["ExampleData/numberdata.csv"] Where does Mathematica go on my system to find the file numberdata.csv? Or, what Mathematica command will ...
1
vote
1answer
45 views

Moving files around

In order to introduce some order into the chaos, I want to move all pdf files on some big directory, say, "U:\", into a library directory, say: "U:\Library". So I get a list all files situated ...
8
votes
2answers
341 views

Case Sensitive File Names Windows(POSIX)

Is there an undocumented way to work with case sensitive files in Windows(If not is this a bug - it doesn't appear to match OSX or Linux behavior)? First enable case sensitivity in Windows. Then ...
1
vote
2answers
334 views

Pop Up for Setting directory path

I am trying to build certain modules in Mathematica 9. I want it to dynamically ask for the directory path ( like file explorer ) when the code cell is executed. How can I do that ? ...
2
votes
1answer
86 views

Set permission of created directories by CreateDirectory

What determines permission mask of directories created by CreateDirectory? Calling CreateDirectory["/tmp/dir"] gives ...
1
vote
0answers
36 views

How to test if Import was successful? [duplicate]

I am importing and processing a bunch of files. Sometimes, for whatever reason, some of these files are not successfully imported so I'm looking for a way to Abort ...
12
votes
1answer
130 views

Path Names Longer Then 256 on Windows

Is there a way to work with pathnames that are longer then the typical 256 in Mathematica? For example run the following in Cygwin ...
3
votes
1answer
99 views

SetDirectory has problems when path is long and contains too many “_” [closed]

The following example code does not work (error: "Cannot set current directory ..."). I am running Mathematica 10.2.0.0 on Windows 10. ...
2
votes
1answer
183 views

Relative Path in Mathematica

I am aware of this question: Relative paths for portable notebooks in Mathematica In the answer it is said that Directory[NotebookDirectory[]] is the ...
2
votes
1answer
39 views

Import variable assignments from external files into different contexts

(I use Mathematica 9.0.1 on OS X 10.10.5.) I have two text files. One is named file1.txt with the contents ...
1
vote
0answers
32 views

Problem of FileEncoding of the output file of FileTemplateApply

Problem of FileTemplateApply FileTemplateApply will change a file-encoding[UTF8] into a file-encoding[WindowsANSI], it seems it doen't accept CharacterEncoding ...
5
votes
2answers
103 views

How to load a file in a directory inside the current working directory

How can I use something like that NotebookEvaluate[ "Mathematica\\SomeFile.nb"]; Instead of ...
93
votes
1answer
5k views

File-backed lists/variables for handling large data

Background Currently I am working with some large data (most of it generated by Mathematica itself). I usually find it a hassle to do this. For example, I just exported a large amount of data to ...
7
votes
5answers
196 views

Nested list from a flat folder list

I have a list of folders and files in my current working directory as a result of a built-in function FileNames: FileNames["*", "", Infinity]]. It looks like this: ...
0
votes
0answers
161 views

How to automatically Import, Name and Export multiple images? [duplicate]

I have a directory (myDataDir) full of images ("myImage1.tif", "myImage2.tif", ...), and I ...
3
votes
2answers
2k views

How to change working directory for calculation and save

I'm having a problem setting the working directory. I want to do some computation and save my data at one location (D), but in the code below you can see that mathematica shifts automatically to a ...
3
votes
1answer
168 views

Get the creation time of a file

Windows is able to tell me when (date & time) a file in the file system was created or altered. Is it possible to get such information in Mathematica, e.g., get the creation time of a text file ...
1
vote
2answers
282 views

Processing all files in a folder automatically

I have a lot of files in a folder that needs to be process through a function that I have written in Mathematica. I need help writing a code that would process all the files automatically. ...
2
votes
1answer
43 views

How to use MakeExpression in terminal?

This is in continuation to the question in Infix form of PutAppend ( >>> ) does not work with variable. I was trying to use ...
11
votes
1answer
108 views

Is there a way to stop Export if the file size is too big?

I've got code that's exporting a file, but the file might be so big that it will take up too much space on the cluster I'm using and crash other users' processes. Is there anything like ...
0
votes
1answer
120 views

Export array data into a file

I tried to solve some equation for different values of parameter t and put results into array. Then I wanted to write this data into a txt-file. So i did it with ...
9
votes
1answer
536 views

Mathematica 10 doesn't support path containing Chinese characters

Bug introduced in 10.0 and fixed in 10.0.2 I tried to import file in Mathematica 10 ( windows 7 system), the path contains some chinese characters. After holding ctrl+shift, and drag the file into ...
6
votes
1answer
196 views

Watch File in Directory .NET

How might I watch for a specific file to change in a directory using Mathematica/.NET code? The following works in .NET but fires twice when you change the file. ...
8
votes
1answer
116 views

How to test if file exists on the front end machine?

When using a remote Mathematica kernel, how can you test if a file exists on the local front end machine? Of course FileExistsQ cannot be used in this scenario, ...
0
votes
0answers
32 views

How to attach raw data to a mathematica file? [duplicate]

I have to send my Master's Thesis to the professor and I don't know how I can send him the mathematica file and the raw data files so that he doesn't have to change all the paths for the importing. ...
9
votes
2answers
273 views

How to return notebook's own file name

What command within a notebook will return the file name of that notebook?
3
votes
1answer
79 views

Analogue of NotebookDirectory[] for scripts (to get the directory path of my script.m)?

Is there a way to get the script directory from inside a Mathematica script? I want a function analogue to NotebookDirectory[] (which doesn't work for scripts). Is ...
0
votes
1answer
49 views

Mathematica Save Directory [closed]

Mathematica saves everything to Documents. I want it to save it into a folder Documents/Mathematica.
1
vote
2answers
58 views

Deleting a line from a file

I'm writing a Mathematica script that writes output to a file every 10min as backup. However, I'd like it to overwrite the previous content so as not to use to much storage. Is there a function for ...
2
votes
1answer
76 views

SetDirectory[NotebookDirectory[]] in one notebook causes Directory[] to change in a different notebook

This is causing me lots of problems. I found that issuing SetDirectory[NotebookDirectory[]]; in notebook A.nb causes subsequent ...