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

1
vote
2answers
77 views

Export with different address

Is it possible to use the Export[] command and add another address other than the usual Home directory that is used?
2
votes
0answers
33 views

Using a variable in Get [duplicate]

This question is different from the answer here Infix form of PutAppend ( >>> ) does not work with variable becasue it is dealing with folders and not filenames. I have a file path which I ...
10
votes
1answer
188 views

Infix form of PutAppend ( >>> ) does not work with variable

I'm new to Mathematica, so I suspect this question involves either a misunderstanding involving variables or the usage of >>>. On a webMathematica page ...
5
votes
1answer
167 views

How to trash files / directories?

Both DeleteFile and DeleteDirectory can only delete files / directories, and lack the option to move them to the trash. Is ...
5
votes
2answers
134 views

How to resolve a Unix symlink?

Does Mathematica have any function to resolve a Unix symlink (recursively, if necessary) to its real path?
4
votes
2answers
134 views

Equivalent of __FILE__?

Many languages define a special identifier whose value is the path to the source file currently being processed. (For example, in C, this is done through the ...
1
vote
1answer
89 views

Techniques To AutoReplace Browse

Let's say I have a function of the form. Test[File_,text_] What would be the most automated way and flexible way to generate an input cell of the form, such ...
1
vote
0answers
75 views

ReadList with type Expression unable to read scientific notation? [duplicate]

I have a file that defines an array of numbers like this: freq["AQs"] = 8.846947803007962E-4 ... I am reading the file with ...
3
votes
2answers
524 views

Importing data into an array, column by column

I'm building a large matrix having different sized rows consisting of a few columns. The different columns are imported .txt files. Why can't I build the matrix column by column? For example, I ...
2
votes
2answers
368 views

Combine multiple notebook files into a pdf/rtf/word/etc file?

It's the end of the semester and I have a prof who wants me to turn in a printout of the nb files ive worked on. I have 33 separate files, and I was wondering if there was any easy way I could combine ...
14
votes
2answers
175 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 ...
6
votes
2answers
331 views

Using NotebookDirectory in batch-mode

I am running Mathematica via the terminal (Linux) and my .m-script contains the command: ...
11
votes
2answers
528 views

DumpSave for the forgetful

A few weeks ago I created a big matrix, and in order not to have to recreate it, I stored it using DumpSave["file.mx", variable]. Now I want to read it back in and ...
4
votes
2answers
153 views

Cusom 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 ...
0
votes
1answer
158 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 ? ...
3
votes
0answers
292 views

Cannot save file

Hello I have a problem in saving files in Mathematica. I can't save not only notebooks but also figures. When I choose to save the notebook it open a window that says: Mathematica could not find ...
5
votes
1answer
96 views

What happened with the file?

What happened with this file? infile = "\\test data.txt"; outstr = OpenWrite[infile]; instr = OpenRead[infile]; Read[instr, Record]; Close[instr]; All ...
4
votes
1answer
348 views

Doubts on scripting: error messages when trying to run and how to process lots of files

I have created my first mathematica 'program' as I think of it, to do some image processing. After reading in an image, it does a lot of stuff (including smoothing, fourier transform, functional ...
-2
votes
1answer
118 views

How can I check which file is modified in specific directory?

I want to find which files are recently modified in a specific directory. For this purpose, I wrote a function named Test. The function's argument is ...
13
votes
5answers
468 views

Using ReadList and Skip to read a file with periodic alternation of useful and useless data

I am trying a read a file that's arranged such that there's alternating set of rows containing data that I don't need and data that I need. So for my case the first n lines in the files are useless to ...
-3
votes
2answers
240 views

How to output Mathematica Lists as a Table to a file?

Given the following List: ...
4
votes
0answers
73 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
199 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.
19
votes
4answers
812 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
235 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 ...
8
votes
3answers
391 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
239 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 ...
2
votes
1answer
541 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
338 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
224 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
162 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
227 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
330 views

StringJoin/FileNameJoin doesn't quite work in script

My mathematica script is as follows: ...
5
votes
1answer
436 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
269 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
656 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
380 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
305 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
187 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
399 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
733 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
2k 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
259 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 ...
12
votes
2answers
302 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 ...
36
votes
3answers
827 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
171 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
261 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 ...
14
votes
3answers
960 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 ...
76
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 ...