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

2
votes
1answer
54 views

Get the last line from 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 ...
4
votes
1answer
138 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
33 views
0
votes
3answers
74 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
52 views

How to set an absolute path name using SetDirectory?

I tried the following: Directory[] /Users/John SetDirectory["Library/Mathematica"] ...
0
votes
1answer
67 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
47 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
82 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
71 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
52 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
116 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
75 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
59 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
156 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
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
68 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
124 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
67 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
122 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
165 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
152 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
144 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
139 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
134 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
112 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
147 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
100 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
65 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
148 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
81 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
128 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
123 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
65 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
70 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
122 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
93 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
210 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
73 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
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
117 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
772 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
135 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
167 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
76 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
184 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
159 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
132 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
133 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
85 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 ...