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

0
votes
0answers
20 views

How to attach a notebook to a question? [migrated]

As I have posted a number of times, I am still learning how to do things here. I was wondering if someone could help me to figure out how to attach a notebook file to a question. Thanks Tarynn
2
votes
1answer
54 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 ...
-6
votes
0answers
53 views

rename files randomly

I need to read a directory with pdf files, rename them by numerical sequence of 8 digits when lifting with pdf extension, and then record the result (the idea is that they are totally random names ...
4
votes
0answers
85 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
84 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 ...
1
vote
0answers
53 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 ...
1
vote
1answer
66 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
85 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?
0
votes
0answers
55 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
45 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
290 views

How to make a better `Sort` in my case

I have some file names like this: ...
2
votes
0answers
53 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
59 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 ...
0
votes
1answer
39 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
48 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
63 views

How to batch convert a directory of images to thumbnails?

I have 50k images to resize, my first attempt at this was: ...
0
votes
1answer
59 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
43 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
84 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 ...
0
votes
1answer
25 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: ...
5
votes
0answers
73 views

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

Problem: So, if your notebook has a private stylesheet and it has a parent stylesheet, you can't delete that parent, in the same FE session, after the notebook is closed. Minimal example: We are ...
0
votes
0answers
58 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 ...
2
votes
3answers
70 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
1answer
41 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]}]; ...
0
votes
1answer
74 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 ...
4
votes
1answer
95 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
2answers
76 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 ...
4
votes
3answers
175 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
2answers
87 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 ...
1
vote
1answer
59 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. ...
6
votes
1answer
74 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 ...
2
votes
1answer
53 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 ...
5
votes
2answers
72 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 ...
2
votes
1answer
57 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 ...
2
votes
2answers
76 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 ...
6
votes
0answers
67 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 ...
1
vote
1answer
61 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 ...
25
votes
0answers
413 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 ...
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
144 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 ...
8
votes
2answers
438 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
1answer
94 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 ...
3
votes
1answer
117 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. ...
3
votes
1answer
124 views

Set permission of created directories by CreateDirectory

What determines permission mask of directories created by CreateDirectory? Calling CreateDirectory["/tmp/dir"] gives ...
2
votes
1answer
232 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
42 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
34 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
119 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 ...
7
votes
5answers
203 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: ...
3
votes
1answer
170 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 ...