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

Copy files existing in different directories under the same directory

I have many files existing in different directories, I need to copy it under the same directory. Any suggestions?
3
votes
1answer
86 views

How does Mathematica use system environment variables?

Is there a common way in which environment variables are accessed, stored, or used by the kernel? There are built-in functions for querying and setting vars in the system environment, but there are ...
1
vote
2answers
75 views

Change Temporary Directory

How to change the value of $TemporaryDirectory ? I need to change it because there is not enough space on the C drive and the calculation seems to stop after a while !
7
votes
0answers
60 views

Is there a way to stop Export if the file size is too big?

I've got code that's exporting a file, but the file might be so big that it will take up too much space on the cluster I'm using and crash other users' processes. Is there anything like ...
7
votes
1answer
80 views

why CopyFile cannot overwrite existing file?

CopyFile return $Failed when the file exists on destination. is there any way to force CopyFile to overwrite the existing one? the way I use now is DeleteFile and ...
0
votes
0answers
17 views

How to get the subdirectory of a ftp weblink?

For example, I can use FileNames["*",dir] to get all subdirectory under dir if dir is some directory of my local computer. Suppose that I want to get all ...
2
votes
1answer
52 views

What's the complete list of file name extensions used by Mathematica?

What's the complete list of file name extensions used by Mathematica? The ones I know are Before V8 .m .nb .mt After V9: ...
1
vote
0answers
36 views

Default starting location of “Save as…” dialog in OS X [duplicate]

In the answer to this previous question, user Szabolcs says On OS X (I'm using 10.9 and Mathematica 9) the file chooser dialogue will remember the last location you used. So if you Save/Open ...
5
votes
2answers
57 views

Error when implementing StartProcess[] in loops (Do, While, Table)

I'm using Mathematica to control another program (Surface Evolver) through the terminal (ie using StartProcess[]; and ...
1
vote
1answer
40 views

How to copy a uncertain name file with the command CopyFile in Mathematica

I have many files named like this "GSM697492_500_D1.CEL", and a another file which contain the first part of the file name like this"GSM697492". I want to copy the some of the CEL files from one ...
4
votes
2answers
71 views

Minimal label to distinguish among a list of directories

I have a list of long directory names. For each directory name, I need a label just long enough to distinguish itself from the rest. Each label should be a ...
4
votes
1answer
99 views

Watch File in Directory .NET

How might I watch for a specific file to change in a directory using Mathematica/.NET code? The following works in .NET but fires twice when you change the file. ...
3
votes
1answer
40 views

Where can I permanently modify Directory[]?

First I set SetDirectory["F:\\learning_mma"];Directory[](*ok,success*) and then I quite the kernel: Quit[] an then ...
2
votes
1answer
46 views

What's wrong with this RenameFile?

I want to rename a .txt file. For example create a file on your Desktop and name it use TEST.TXT, now I want to rename it to ...
0
votes
2answers
43 views

Use modified part of file path as new file name

i want to import an image, modify it and then export the modified image. Something like this: img = Import["C:\\Images\\e4271-5.jpg"] Some modifications ...
11
votes
0answers
103 views

A documented syntax of FileNames doesn't work?

According to the documentation for FileNames: However when I attempt to use this syntax I get an error: ...
0
votes
1answer
39 views

Rename a list of files [duplicate]

I need to rename a list of files .bmp having name like 1.bmp, 2.bmp,...,155.bmp. I want to get a list of files having the same number of digits in name like 001.bmp,002.bmp....,155.bmp. I am trying ...
3
votes
1answer
48 views

Windows Insert File Path

Suppose I want to Save["filename", foo] under Windows. Ordinarily, the way to deal with file names under windows is to open the Insert dialogue and find a file path, but in this use case, the file is ...
9
votes
0answers
46 views

$Path hijacked by PacletManager?

Summary: Since Mathematica version 6, the PacletManager seems to have engineered an escalating hijack of the $Path variable. Add-on packages need to have a ...
4
votes
2answers
122 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 ...
15
votes
1answer
159 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, ...
2
votes
2answers
81 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: ...
3
votes
1answer
79 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
59 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 ...
2
votes
1answer
108 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 ...
5
votes
1answer
247 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 ...
0
votes
1answer
47 views
-1
votes
3answers
85 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 ...
2
votes
2answers
74 views

How to set an absolute path name using SetDirectory?

I tried the following: Directory[] /Users/John SetDirectory["Library/Mathematica"] ...
0
votes
1answer
86 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
60 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
95 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
89 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 ...
3
votes
1answer
59 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
288 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
1answer
80 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?
1
vote
2answers
81 views

How to generate a unique file name similar as that created by CreateTemporary

CreateTemporary can generate a unique file name like ...
1
vote
3answers
290 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
101 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 ...
11
votes
3answers
143 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
74 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
134 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 ...
3
votes
1answer
181 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 ...
5
votes
2answers
166 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 ...
2
votes
2answers
160 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: ...
4
votes
1answer
155 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 ...
1
vote
1answer
153 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
142 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” ...
1
vote
2answers
167 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
114 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 ...