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

15
votes
1answer
148 views

File-name completion for custom functions

Mathematica 10 has introduces file name completion. It works only with certain built-in functions such as Import, SetDirectory, ...
4
votes
2answers
106 views

Find file names in directory

I am trying to find the list of any file in any directory of a given name (by in the directory, I mean directly in the directory, so in a directory which is in the directory would not count). For the ...
2
votes
2answers
74 views

Overwriting first line of large file

As mentioned, I wish to read the first line of a file, and if needed, overwrite it with a new string. The aim is to have a CSV with a list of possible elements. Example: ...
2
votes
1answer
102 views

Get the last line from each of a large number of files, transform them, and write all results to a single new file

I have several hundreds of .csv files that are not logically named (contains numbers, characters, and special characters), all stored in a directory. Each file has large but unequal number of rows and ...
3
votes
1answer
71 views

how to write TableForm expression into file?

Now I have a list stored in data as follows data = {{"Ca", 1, 1, 1}, {"Ca", 2, 2, 2}, {"Ca", 3, 3, 3}} the ...
2
votes
1answer
54 views

How to read from /dev/random?

I am looking to read a few bytes from /dev/random on OS X and Linux. The simplest approach fails on both operating systems (see below). Why? What is a ...
5
votes
1answer
204 views

Mathematica 10 doesn't support path containing Chinese characters

I tried to import file in Mathematica 10 ( windows 7 system), the path contains some chinese characters. After holding ctrl+shift, and drag the file into front end. I got path like ...
-1
votes
3answers
83 views

How do i import a list of files, choosing the name

I have this list of files, i'm using FileNames[{"*.txt"}, NotebookDirectory[]] to import it, but i just want the ones without inelastic on the name. How can i select just by the name? Thanks ...
0
votes
1answer
46 views
2
votes
2answers
60 views

How to set an absolute path name using SetDirectory?

I tried the following: Directory[] /Users/John SetDirectory["Library/Mathematica"] ...
0
votes
1answer
78 views

Loading and processing five files at a time from a directory containing many, many files

I have 3000 files (for example: aa101.csv, aa108.csv, aa120.csv, ...) and I need to process them. I need to load five files from a folder, process them, and export them to new list in Excel. Then I ...
2
votes
1answer
54 views

Get names of all folders in a directory [duplicate]

I simply want a list of the folder names (without subfolders) in a directory, but can't seem to find the right command for this. Can anyone help me out :)? Thanks in advance
2
votes
2answers
90 views

Specify column width while exporting

I am trying to export a set of data into a file but I can not force mathematica to keep a certain width for each column. For example, when I export a table: ...
0
votes
2answers
77 views

Creating directory structure through Mathematica

Is there mkdirs() (make directory structure) equivalent in Mathematica? I want to specify something like this : dir1/dir2/dirn ...
1
vote
1answer
77 views

Merge StyleSheet into a notebook

I have a custom style called style1.nb and I want to install it into a notebook Class01.nb so I can send only the notebook file to my students with the style of style1.nb. Is that possible?
3
votes
1answer
56 views

Order imported files by their alteration date

Probably a very easy question, but I could not find the answer, so it would be very nice if you can help me: Let us say I have 10 files, all with the extension ...
0
votes
1answer
179 views

NotePad++ User defined language

I know there is a xml file with language for Mathematica notebook (nb or m files). The link is http://sourceforge.net/apps/mediawiki/notepad-plus/?title=User_Defined_Language_Files Now I want a xml ...
1
vote
2answers
68 views
3
votes
1answer
170 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
522 views

How to set default save directory for notebooks?

Based on certain previous questions, I figured that if my NotebookBrowseDirectory looked like this ...
1
vote
3answers
191 views

How to export data to a plain text file?

I am preparing data used by a command line program. It requires data in a simpliest possible format: value_x1 value_y1 value_x2 value_y2 ... value_xN value_yN ...
0
votes
1answer
77 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
99 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
74 views

Export CSV from tables

I am reading my csv which looks like: float,float,float,integer,boolean I read it with: ...
10
votes
3answers
132 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 ...
2
votes
1answer
70 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
123 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
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 ...
5
votes
2answers
158 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
144 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
149 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
145 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
125 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
163 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
155 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
104 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
67 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
155 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
863 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
84 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
129 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
136 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
66 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 ...
19
votes
4answers
802 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
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
127 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
96 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
219 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
81 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
124 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 ...