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

3
votes
1answer
170 views

Windows Explorer Natural Order

Currently there are a list of notebooks in Windows that I am processing in a folder. Ideally I would like the notebooks to be concated in the same order as how they display in Windows Explorer. I ...
1
vote
2answers
86 views

Identify / change working directory for the InstallableNET runtime

I am currently attempting to use .NET/link to call a third party DLL from Mathematica using DLLDefinedFunction. I have been able to link against and call many of ...
2
votes
2answers
149 views

Fastest way to concatenate many text files in a given directory

I have about 1 million .txt text files in a directory which I would like to all concatenate in one single text file (separated by a newline character "\n"). Because of the number of files and their ...
5
votes
2answers
136 views

Reading non-tabular data with NaN-s from file

A NaN stands for an entry that is not a number/undefined/missing/infinite/etc. On my machine the C code printf("%f", 0/0.) produces ...
0
votes
2answers
69 views

when using FileDate----The Creation date of a file is not available on Macintosh and Unix?

when I use FileDate[filename,"Creation"] it gives messages like FileDate::nocreationunix: The Creation date of a file is not available on Macintosh and ...
3
votes
1answer
71 views

Why does Thread FileDate give an error message?

I tried for example Thread[FileDate[FileNames["new*", "h:\\temp\\", 1]]] It gives FileDate::fstr: File specification ...
4
votes
2answers
134 views

Find a notebook I had open recently

I worked on a notebook a few weeks ago and now I can't find after looking through the most likely directories. The recent list only has 6 items in it, none of them the notebook in question. Is there a ...
2
votes
1answer
99 views

Why is FileNameJoin not working?

I can not figure out why the code below doesn't work? aaa >> FileNameJoin[{Directory[],"input"}] error message came out saying OpenWrite::noopen: ...
6
votes
2answers
235 views

Using Read for calling external command does not release file handle

The standard and robust method for piping to/from external commands under Windows is to create a temporary file, save the input into it, pipe it to the command and save its output to a second file. ...
0
votes
1answer
79 views

Configure initial directory

How can I configure the initial directory? By configure, I mean set it so that when Mathematica starts the initial directory is one of my choosing. By the by, what exactly is the significance of the ...
2
votes
1answer
82 views

File output and race conditions

Is it possible to know when Mathematica is done writing a file? I'm looking to automate something and I'm wanting to have Mathematica put it in a file using Put[], ...
0
votes
1answer
131 views

String to File removing quotation marks

If I print a string to a file it also adds quotation marks to the string. Here is an example: a = "test \t test" a >> file FilePrint["file"] How can I ...
9
votes
2answers
1k 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: ...
3
votes
3answers
145 views

Properly ordering the output of FileNames for a directory consisting of files with consecutive integer names [duplicate]

Say I have a number of files in a directory at some location (C:\dir1\dir2\dir3...), and I pull an array of strings corresponding to the file names with the command: ...
7
votes
1answer
186 views

Name of current Notebook

I've searched the documentation, this forum and with google, but I was not able to find how to ask Mathematica to give back the name of the current notebook file one is working on. Perhaps something ...
1
vote
2answers
78 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
35 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
198 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
168 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
136 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
135 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
90 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
551 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
388 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
176 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
341 views

Using NotebookDirectory in batch-mode

I am running Mathematica via the terminal (Linux) and my .m-script contains the command: ...
11
votes
2answers
552 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
155 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
166 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
329 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
351 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
121 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
491 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
258 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
203 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
832 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
242 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
398 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
261 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
589 views

How to set default save directory for notebooks?

Based on certain previous questions, I figured that if my NotebookBrowseDirectory looked like this ...
7
votes
4answers
346 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
237 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
168 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
239 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
335 views

StringJoin/FileNameJoin doesn't quite work in script

My mathematica script is as follows: ...
5
votes
1answer
458 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
274 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 ...