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

5
votes
2answers
80 views

How to define a function to save a list to a same-name file

I want a convenient way to save lots of intermediate data lists into files, so that next time the files can be imported automatically to homonym list variables in the notebook, without having to ...
0
votes
0answers
27 views

Pass list title as argument? [duplicate]

I have a function that works with a list and outputs it. Is it possible to also get the name of the list as an argument? Right now my code is ...
5
votes
0answers
34 views

How can I move he documentation to another location after install on Windows?

How can I move he documentation to another location after install on Windows? I would like to move the documentation to another partition on my Windows filesystem. Michael Hale in chat recommended ...
3
votes
1answer
34 views

How to use Write[stream, expression] without automatic addition of next line character

I am writing a C code for solving a big set of differential equations. I am trying to use Mathematica to export some of the long expressions to C. I would like to know how I could use Write[stream, ...
3
votes
1answer
70 views

Can I get a list of more than fifteen of the most recent notebooks opened?

When I go to the pull-down options for “File”, one of them is “Open Recent”. It lists the last 15 notebooks opened. Is their any procedure to follow to get more (than 15) of the latest opened ...
2
votes
2answers
81 views

Generating a list of file names

I have set of files in the format 20160615-1-0.asc, 20160615-2-0.asc,... 20160615-5-0.asc etc. The following commands can List the file names at once which can be used to import later. ...
4
votes
1answer
62 views

Get n filenames in a directory?

I have a single flat directory with over a million files. I just wanted to take a sample of the first few files but FileNames doesn't include a "only the first n" ...
1
vote
0answers
44 views

How to Import file from subdirectory of ZIP file?

I have a "ZIP" file that contains directories. Import["arch.zip", "FileNames"] (* {"subdir\\test.txt"} *) However, ...
4
votes
0answers
33 views

How to specify drive name and network share in FileNameJoin

The benefit of FileNameJoin is that you don't need to worry about the operating system's formatting of directory paths. I need to specify a directory path to a ...
2
votes
2answers
130 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 Notebook)...
29
votes
1answer
553 views

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

In Mathematica 10.x, one now has both .wl Wolfram Language Packages and .m Wolfram Mathematica Packages. What's the ...
7
votes
4answers
197 views

Searching a phrase in all *.nb files

I have so many *.nb files in a folder. In one of them I have written a phrase, unfortunately I cannot remember that file. I am searching about it and the file in ...
6
votes
0answers
103 views

How to unlock a stylesheet which is not needed anymore by the FrontEnd

Reply from WRI Support: [...] This indeed seems to be an issue with the Frontend on Windows and I have alerted the development team about this. Unfortunately I do not have a work around at ...
20
votes
3answers
3k views

Relative paths for portable notebooks in Mathematica

I cannot find how to use relative paths in Mathematica. My directory structure is simple. ...
2
votes
1answer
70 views

Using Mathematica to batch-produce text files

I need to make a bunch of plaintext files, all of which differ only in a single parameter. The text I want to "copy" or "batch produce" is a little bit complex, since it contains quoted areas and ...
4
votes
0answers
92 views

Creating compiled search TRIE file for argument string completion

I'd like to generate a compiled search TRIE file (like those found in $InstallationDirectory\SystemFiles\FrontEnd\SystemResources\FunctionalFrequency\) to help ...
6
votes
1answer
88 views

How to make captions for a movie?

I'm trying to make my own video parody with custom subtitles. Creating your own custom subtitles file in a text editor with the SubRip or .SRT format is easy to do, it looks like this: Where 00:...
1
vote
0answers
73 views

Why do I get “There appers to be an error in the file named below”?

For first time in my life, I have just suffered the error: " "There appears to be an error in the file named below". "Parse and load the entire notebook upon opening.", doesn't help. I have saved ...
4
votes
2answers
220 views

Custom PopupMenu file selector

Lately I come across what I think not uninteresting problem which is a good exercise for the usage of Dynamic. Assume you have files in a directory structure (a ...
1
vote
1answer
91 views

How to delete notebook files from the Wolfram Cloud

I have version "10.0 for Mac OS X x86 (64-bit) (September 10, 2014)" I have several notebooks stored in the Wolfram cloud, but don't see how I can delete certain ones I no longer need.
1
vote
2answers
90 views

How to join .txt-files without importing?

Is it possible to write a code, telling MMA to join 2 (or even more) .txt-files without importing them?
5
votes
1answer
235 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. ...
25
votes
2answers
6k views

How to import all files of a folder at once?

I know how to import one textfile by calling its name filestring = Import["myfile.tex", "Text"]; Then "filestring" is a string with the myfile content. How do ...
0
votes
0answers
64 views

Notebook contents changed upon re-opening

Cross-posted in http://tieba.baidu.com/p/4439694061 I was so puzzled that why in Mathematica after I saved the nb file and when I opened it again the contents changed totally? Another point that ...
1
vote
2answers
49 views

Why autocompletion of file name is not working in notebookdirectory?

I use windows system and Mathematica 10 The default working directory is c:\\user\\name\\document If I type Import["xx , ...
6
votes
3answers
292 views
2
votes
0answers
55 views

Using DirectoryQ difference with windows and Unix naming, forward slash problem

update: send email to Wolfram support. CASE 3561304. Will update if they confirm this is a bug or not. Should Mathematica DirectoryQ["z/"] return False when the ...
1
vote
1answer
64 views

Inconsistency of WriteString

Important Note A kernel or maybe Front End restart probably fixed the problem. I did something weird today which is evaluate Context[StringQ]="test`", perhaps that ...
18
votes
2answers
244 views

How to find the package file that stores a certain symbol?

Is it possible to figure out in what file a certain packaged symbol lives in (assuming there is no shadowing between multiple identical symbol names)? I would like to have a function that if, given a ...
0
votes
1answer
42 views

Finding text files in a given path and applying a function to those files

I made a function called "SolveLinearSystem[]" that solves,as its name suggests, a linear system of any amount of variables. It takes the path of a text file as its only argument. The function then ...
3
votes
1answer
56 views

What causes the error NotebookEvaluate::nbnfnd?

Help says: NotebookEvaluate can take either a NotebookObject or a filename referencing a notebook file. therefore, I wonder why ...
0
votes
2answers
73 views
0
votes
1answer
75 views

How to set the current Directory as the default?

Everytime, before my code, I always write, SetDirectory[NotebookDirectory[]]; So, how to make this as the default ?
1
vote
1answer
52 views

DOS-like Wildcard for Filtering List of Files [duplicate]

I have a list of file names that I would wild like to filter based on a DOS like wildcard specification similar to what can be used as the first argument,"forms", of ...
3
votes
2answers
94 views

Cannot find BaseDirectory or UserBaseDirectory in Mac OS El Capitan

I am new to Mac OS, so this might be a silly question, but.... I just searched for $BaseDirectory and $UserBaseDirectory in my ...
3
votes
1answer
149 views

Set permission of created directories by CreateDirectory

What determines permission mask of directories created by CreateDirectory? Calling CreateDirectory["/tmp/dir"] gives ...
0
votes
1answer
27 views

FileBaseName and a dot in the folder name

FileBaseName["F:\\2016-02-23\\11.5_mm_fan_off_pumps_off_1500_hz_3793_\ images_2048_1472_pixels_20160223_1649_time_part"] should give the base folder name: ...
0
votes
0answers
61 views

Why does this code produce an infinite loop?

I can't understand the way this code behaves and suspect that is because of some unrecognized reasons of general interest. Otherwise, I apologize and will retire the question. In ...
5
votes
2answers
74 views

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

I use Mathematica10 in my Win7 and I want to estimate the amount of disk space occupied by each dirs. I try the code(the code was copied from How do I find the amount of free space on disk?, actually ...
6
votes
0answers
76 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 drag-...
4
votes
1answer
103 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?
2
votes
3answers
74 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 ...
3
votes
2answers
81 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
78 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 encrypt/...
1
vote
1answer
43 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
102 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
96 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
215 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).
1
vote
1answer
61 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. ...