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
1answer
67 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 ...
0
votes
1answer
84 views

Create new file, based on 500 articles

I've got a folder with 500 newspaper articles. Each article is saved in a seperate file with a number in the title like "1.txt", "2.txt". Each article has a date but it is not clear in which line the ...
2
votes
1answer
52 views

Export CSV from tables

I am reading my csv which looks like: float,float,float,integer,boolean I read it with: ...
9
votes
3answers
109 views

What kind of check does DirectoryQ exactly perform?

I'm using Mathematica 9.0.1 on Windows XP and my drive letters are assigned as follows: C: and D: are hard local disks, while ...
3
votes
1answer
127 views

Writing results directly to file

I am trying to find all simple paths in a large directed graph (542 vertex, density ~ 5%) between two nodes. For this purpose, I use the algorithm from this thread. Unfortunately, my computer is ...
2
votes
1answer
56 views

How to create .ico file in Mathematica?

How to create .ico file in Mathematica? I mean the favicon images used for web sites. Directly using Export["file.ico", <some graphical expression>] does ...
0
votes
0answers
98 views

Savitzky-golay filter

How to use Savitzky-golay filter on csv file? I have file.csv in this format: 0.1,1.6,2.8,0 0.2,1.2,2.3,1 0.7,1.5,2.4,2 0.6,1.2,2.7,3 0.4,1.4,2.9,4 0.3,1.3,2.5,5 ...
14
votes
2answers
161 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 ...
5
votes
2answers
138 views

How does the speed of WriteString compare to other languages?

I'm doing something where the most sensible approach seems to be to open a file and write to it as I process data from some large tables. Old school. While testing the program, I remembered the low ...
4
votes
1answer
115 views

What is the correct way to provide Mathematica with a path to Python user scripts?

What is the correct way to provide Mathematica with a path to Python user scripts? Simply executing Python as a shell command, using something like ...
2
votes
2answers
115 views

How to read non-standard-format data into Mathematica from a file

I would like to read non-standard-format data into Mathematica from a file. How can this be achieved? For example, how can I read the following text file of data into Mathematica: ...
1
vote
1answer
105 views

Read a binary file to an image in memory then analyze it

Is it possible to read a whole file (~100 MBs) into memory, and then use BinaryRead[] function on the data loaded into memory to read/cast it to the types I need with a proper StreamPosition pointer? ...
0
votes
1answer
89 views

How to change the MATHEMATICA_USERBASE directory

I’ve found, from reading the help on MathKernel in the help system and in a number of questions here, that to make that change in Windows at least one apparently needs to enter “MathKernel … options” ...
5
votes
1answer
152 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 ...
1
vote
2answers
121 views

Processing all files in a folder automatically

I have a lot of files in a folder that needs to be process through a function that I have written in Mathematica. I need help writing a code that would process all the files automatically. ...
1
vote
1answer
75 views

how to show or find full path of file listed in the File->Open dialog?

This question was posted 2 days ago at community. I had a good answer but it does not quit do what I wanted. Hence I am trying here to see if someone might know of some other solution. Here is the ...
2
votes
1answer
54 views

How to use relative paths in a notebook? [duplicate]

To maintain mobility of project files, I want to use relative paths in my notebooks. For example, I have a directory named "proj" and my notebook file is located in this directory. Meanwhile, I have ...
3
votes
1answer
122 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 ...
9
votes
2answers
549 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: ...
1
vote
2answers
70 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 ...
5
votes
2answers
102 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 ...
2
votes
2answers
114 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 ...
0
votes
2answers
60 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 ...
18
votes
4answers
648 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 ...
3
votes
1answer
69 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
117 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
89 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
180 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. ...
2
votes
1answer
76 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
97 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 ...
3
votes
3answers
123 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
153 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
74 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
169 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
2answers
124 views

How to resolve a Unix symlink?

Does Mathematica have any function to resolve a Unix symlink (recursively, if necessary) to its real path?
1
vote
1answer
83 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 ...
4
votes
2answers
131 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 ...
6
votes
2answers
243 views

Using NotebookDirectory in batch-mode

I am running Mathematica via the terminal (Linux) and my .m-script contains the command: ...
1
vote
0answers
74 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
313 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 ...
4
votes
1answer
315 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
2answers
290 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 ...
11
votes
2answers
402 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 ...
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. ...
4
votes
2answers
123 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
112 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
235 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 ...
-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.
5
votes
1answer
95 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 ...