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
70 views

Accessing files in different directories [duplicate]

I have a problem that I am trying to work on. My Folder structure is like this. Application(MainDirectory) AppData( Secondary directory where files are Design.m, Layout.m, and Evaluation.m) ...
-4
votes
2answers
186 views

How to split a file?

Is there a way to split an external file using Mathematica? (Other than importing it, dividing it internally and exporting the parts) For instance like some File Split utility do.
18
votes
4answers
645 views

ReadList problem related to Record type

A simple file reading issue is baffling me here. I am reading a around 200 MB textual file in .dat format. Now the file contains many lines but to phrase my problem ...
1
vote
1answer
209 views

Renaming files of form FileName(i).csv to NewNamej(k).csv where j increments and k resets to 1 when there is a jump in i?

Edit up top: The accepted answer works splendidly except I had to add //ToExpression to the end of the definition of ns given by ...
7
votes
3answers
361 views

Visualizing directories

How do I plot the content of a directory and all its subdirectories into infinity using TreeForm? I've tried using a mix of FileNames, StringSplit and GatherBy but in the end I couldn't find even a ...
4
votes
1answer
202 views

Execute code when file is modified

I have a function the takes some time to complete. The function imports data from a .csv, parses it, and plots certain vectors from there. The .csv is constantly being updated from an external ...
1
vote
0answers
359 views

How to set default save directory for notebooks?

Based on certain previous questions, I figured that if my NotebookBrowseDirectory looked like this ...
6
votes
4answers
304 views

How to batch rename a directory of files?

I have a directory of files with the pattern: "some_number.some_name.pdf" I want to remove the "some_number." part from all the ...
2
votes
1answer
187 views

Restrict SystemDialogInput to open certain file types

The documentation for SystemDialogInput shows how to restrict the types of files shown. SystemDialogInput["FileOpen",".nb"] ...
3
votes
1answer
146 views

Manipulate and FileNameSetter don't want to play nice together

In a Manipulate, one can specific the type of an individual control like so: Manipulate[v, {v, Red, ColorSetter}] I tried to ...
6
votes
2answers
192 views

How do I Export through a standard system file save dialog activated by a Button?

As near as I can tell, Export cannot be configured through arguments or options, to present a standard system file save dialog to the user, so that he can specify a ...
0
votes
1answer
283 views

StringJoin/FileNameJoin doesn't quite work in script

My mathematica script is as follows: ...
4
votes
1answer
337 views

Open data file from CDFPlayer?

Using a CDF program running in CDF Player, is it possible to use a system dialog box, or even just an Import statement such as Import["*.CSV"], to import data from a text or comma separated file on a ...
0
votes
1answer
236 views

SetDirectory - predefined directory possible? [duplicate]

Possible Duplicate: Relative paths for portable notebooks in Mathematica I have a deep subdirectory structure, and the calculations should always be done in one of the deepest ...
-2
votes
2answers
540 views

How to write output in TraditionalForm into external text files?

I'd like to write output in TraditionalForm into external text files ofile.txt. I tried to use ...
24
votes
1answer
345 views

Tool to locate bloat in a notebook?

In developing a notebook, I often find I have created a very boated file that takes a long time to save. I would like to slim it down. It is usually the result of graphics and images, but they may be ...
9
votes
2answers
266 views

How to search a file in a particular system using Mathematica

I want to know if there is any function which can search a file from the whole system and gives the whole path for that particular file. I have tried $Path but it ...
8
votes
1answer
164 views

Drag & drop path info into front end?

On OSX at least, it's possible to quickly retrieve a folder/file path by dragging & dropping the folder/file into the terminal, eg: Is it possible to program Mathematica's front end enable ...
4
votes
2answers
330 views

Importing array with complex numbers

This is probably an easy question: I am exporting the results from a longer calculation into a dat-File, then I set the cell to non-evaluatable and put an Import in front, so I can later work with the ...
6
votes
2answers
630 views

How can I open an Excel file and modify it in Mathematica?

I wanted to ask how can I view an Excel file from a Mathematica notebook and modify it. I have seen a similar question, Open Excel file with Mathematica, but the answer involves .NET. Is there any ...
1
vote
3answers
1k views

How to write values of function to file?

For example, say I wanted to plot Sin(x) like this: Plot[Sin[x],{x,0,2 Pi}] But instead of plotting to a graph, I want to now tabulate the values of Sin[x] to a ...
6
votes
1answer
217 views

How to save data using FileNameSetter or similar

I would like to export data to a file using a SaveAs type dialog, using something like FileNameSetter[name,"Save"] to give a browse button. Any help with this ...
11
votes
2answers
286 views

Mathematica “prelude”

Is there any way to have the functions from a mathematica file be loaded on startup? For example, in this excellent answer, Jens helps me out and gives me some functions for creating legends for ...
35
votes
3answers
722 views

How can I set up a versioning system within a notebook?

Since the Frontend crashes a lot, for important work it would be nice to have the notebook automatically branch and save itself every so many minutes. For instance, commands like ...
13
votes
2answers
1k views

Relative paths for portable notebooks in Mathematica

I cannot find how to use relative paths in Mathematica. My directory structure is simple. ...
3
votes
2answers
162 views

How to check which file is older

Is there a command in Mathematica to check the date when a file was last modified? Suppose I have two notebooks: File1.nb and ...
5
votes
2answers
252 views

How to remove an expression from a file?

To read in expressions from a file, one can do ReadList[file, Expression, 3]. How to do the opposite, i.e. remove a number of expressions from a file, modifying ...
13
votes
3answers
773 views

List all the directories under the current one

I feel like I am forgetting something obvious, and will remember or be ashamed as soon as an answer turns up. However, I cannot for the life of me get all of the directories in the current working ...
75
votes
1answer
3k 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 ...