Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [files-and-directories]

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.

1
vote
0answers
35 views

Privilege violation for file or directory

hopefully somebody can help me out with the following; I have a mathematica .wl script which uses ParallelTable; When I run this locally (laptop) it works ...
2
votes
1answer
34 views

Import files AppendTo and ToExpression

I have a list of files all indexed as filename1,filename2,filename3,... up to 50, all in the same directory, and I wanted an ...
1
vote
1answer
37 views

Programmatic access to Export options for filetype

For specific filetypes, e.g JPG, GIF, etc. I would like to get a list of available options for use in Import and Export. Unfortunately, the obvious thing doesn’t work: ...
1
vote
3answers
79 views

How to import a CSV file of files that have space delimited values?

I've received a data file in a mysterious ".pos" format. It consists of many lists that are separated by the space character; these are in turn separated by commas,e.g., { {a b c},{d e f},...} ...
10
votes
0answers
89 views

What's the difference between these formats?

Unfortunately, the documentation does not give a substantive explanation of the differences between these formats: WDF vs WXF WLNET vs WMLF M vs WL - was answered here: What is the difference between ...
5
votes
2answers
60 views

FileNames not containing a given extension

I would like to get all the files in a directory without a given extension. To get them with that extension is quite simple: FileNames["*.<myExt>", myDir] ...
4
votes
1answer
51 views

Cleanest way to copy part of one directory to another

I often want to copy a directory and clean it up for deployment purposes. This may involve pruning out large datasets, cleaning up private junk, etc. Doesn't really matter. The issue I often run into ...
0
votes
1answer
42 views

Graphing from a file

I have a lot experience with traditional programming languages, but almost none with mathematica. I have data that I've transformed and saved to a file in the format {x,y,time} {x,y,time} ... ...
1
vote
0answers
33 views

Delete content of folders with same name in different subdirectories

I am using Windows 10 and Mathematica 11.3. I have many same named folders (suppose the name "data") in different subdirectories of a base directory (here "d:\dir"). How can I delete the content (...
3
votes
2answers
77 views

Having Mathematica replace DOS line breaks with UNIX in files

Say I have a file named "Silly.tex" which has \r\n line breaks. Is there a way to get Mathematica to convert it to only have \n line breaks? You can find such a file with DOS line breaks at: https://...
2
votes
0answers
52 views

FileNames[] perfomance in mathematica 8.0 and 11.3

OS - Windows. I do the following code in both Mathematica 8.0 and 11.3. In[15]:= t = FileNames["*", "Z:\\Constaint_5_min\\SPP\\Archive\\"]; // AbsoluteTiming "Z:\...
2
votes
1answer
162 views

How to zip folders

I know that one can archive data with Mathematica using: CreateArchive[source,path] I have a lot of folders (folder1, folder2,folder2 etc.) that I would like to ...
0
votes
0answers
18 views

How do I write a table using OpenAppend? [duplicate]

I need to write a table on a file using OpenAppend. This is what I do: ...
1
vote
0answers
43 views

Automatically making a path to the users directory [closed]

I am trying to set the code to regardless of user, it will set the Directory of that user to the desktop. I have tried to use the SetDirectory[] and add that string to another, however the hidden "" ...
2
votes
1answer
23 views

RunProcess returns a confusing error message when using ProcessDirectory options

Here is one way to find the names of the files in one's home directory: FileNames["*", "~"] (* { "~/.account", "~/Applications", "~/.bash_sessions", ... } *) ...
2
votes
1answer
39 views

Using SFTP directories as regular directories

Is it possible to use SFTP directories in a similar way to normal directories in Mathematica? I would like it if I could Import,Export,Get,Put etc to SFTP directories just as if they were normal ...
6
votes
3answers
167 views

Renaming Files with Mathematica

I have a lot of video and text files. They all have the name: "Number-Suómething" So for instance: 02-2.2-raKfcgvtavU.mp4 Is it possible to batch rename all the files using Mathematica to only "...
1
vote
2answers
85 views

About writing a file using Do loop

I want to write a file using Do loop. The loop computes a list of 9 functions whose outputs are floating point numbers. One of the functions produces large numbers ...
0
votes
1answer
62 views

Using of functions and lists from other Mathematica files

I have a code in which I have to use some functions and lists and use them in the body of the code. If I want to type all of them in a file in Mathematica, that file becomes very very long. For ...
1
vote
0answers
50 views

Import file without specifying the directory

Consider a situation when we import some file in a .nb from a sub-directory located at the directory where .nb is located. We need to write specific path to the file. Next, suppose that we moved file ...
1
vote
2answers
64 views

Import files from a directory choose via Manipulate

I thought I write a super-simple program to import all (Excel)files from a directory a user can choose> ...
6
votes
2answers
134 views

DumpSave'ing while lengthy program runs

tldr: is there a way to load all files following a structure/append to DumpSave file i would like to run a script following the structure: ...
0
votes
1answer
36 views

Run a command each time a file is saved [duplicate]

Is there any way to get Mathematica to run a function each time I save a file? So either by ctrl-s or by the 'save' command in the file menu. Then I could, for example, ask it to make a copy of the ...
10
votes
2answers
1k views

How to check whether a .txt file is empty

What is a quick (preferably OS independent) way to check whether a .txt file is empty using Mathematica?
3
votes
0answers
51 views

File selection dialog in autocomplete [duplicate]

How can I create the autocomplete for the function with opening file selection dialog? For example like a autocomplete of the SystemOpen UPD: the answer to the ...
5
votes
1answer
257 views

Opening Mathematica file in Google drive

I have a Mathematica file in my Google drive. There is no option to open the Mathematica file directly, without downloading it. Is it possible to directly open the file from Google drive?
9
votes
2answers
657 views

How to check whether the folder is created, and if not, create it?

Consider a .nb file. How to check whether the folder is present in notebook directory, and if not, create it?
1
vote
1answer
53 views

How do I repeatedly write to a file?

I can use the code snippet below to write the numbers to a file (here on the os x desktop), but when I delete the file (using Finder) and rerun, I get an empty file. Quitting Wolfram Desktop and ...
0
votes
0answers
26 views

Save all the variable with file name containing the Time stamp [duplicate]

How to save all the variable with a filename containing the Timestamp. For example: If the current time is 2:30:56 PM, The file name should be ...
2
votes
1answer
38 views

Which folder should I store the .m file in order to run it using MEvaluate[MScript[“scriptname”]]?

I have installed MATLink and it works fine. Which folder should I store the 'scriptname.m' file, in order to run it using MEvaluate[MScript["scriptname"]]?
2
votes
1answer
77 views

Where is the folder storing the ResourceData files?

I wonder where would the file be stored in Windows when I use the function ResourceData. Since sometimes the data is quite large, I would like to have a look at the ...
6
votes
1answer
38 views

Trace and TracePrint are slow, How to Trace to a file for speed

Trace and TracePrint generates or prints a list of all expressions used in the evaluation of its argument. For complicated ...
1
vote
2answers
101 views

Searching in nested folder

I'll start with an example, as it's easier to explain what I need. Say for example I've a Project folder called "MainFolder". In this folder there are a number of subfolders and nested subfolders. ...
1
vote
0answers
23 views

Real-Time Export of Data

So I was using a Genetic Algorithm to solve a problem. The inherit takes a lot of time to get me to the final answer, so I would like to monitor the process, and export the data real-time. The code is ...
0
votes
0answers
53 views

How to export file in a relative directory in one string?

From the question I know how to import files from relative directory in one string: Import[FileNameJoin[{NotebookDirectory[], "path", "to", "your", "file.xls"}]] ...
7
votes
1answer
141 views

Does Dropbox sync smartly notebook files? [duplicate]

It is said that Dropbox employs a Delta Sync technology where only the modified part of a file is updated through the internet. I was just wondering if it holds for notebook files. I sometimes ...
4
votes
1answer
288 views

How to read this dataset with .dat and .r64 files?

I stumbled upon the European Data Incubator project, and wanted to play around with some of their data. I'm trying to open this dataset, which contains a bunch of ...
3
votes
1answer
410 views

Appending to a .csv file [duplicate]

I have a selection of Lists of data which are in the same format, and if I Export them all to CSV at the same time I get a nice ...
1
vote
1answer
67 views

Catching “$Canceled” from SystemDialogInput [closed]

Below is a minimal example of a DynamicModule which has a button to call up a SystemDiaglogInput to allow the user to select a directory. If the user selects a directory, then the name of that ...
1
vote
2answers
75 views

Manipulate not working as advertised

I have gone through the reference titled Advanced Manipulate Functionality, and I quote from the section titled Dealing with Slow Evaluations: There is no five-...
2
votes
0answers
42 views

Import/AbsoluteFileName does not find file returned by FileNames on network folder

I'm having some issue with Import and AbsoluteFileName used together with FileNames. Take ...
1
vote
0answers
27 views

CreateArchive[] without directory copy [duplicate]

CreateArchive["C:\\temp out\\"] The above creates a zip file containing directory temp out at level 1, but I require just the ...
3
votes
1answer
169 views

How many records? In a file (streaming)

I want to know how many records a file (large data) contains... with streaming...like this: ...
1
vote
0answers
44 views

Why Mathematica says notebook “has changed outside of Mathematica” when saving to text file?

I wanted to export the notebook to plain text file. Given notebook foo.nb, I noticed each time I save the notebook to foo.txt, ...
8
votes
2answers
220 views

What's the fastest way to read a simple numerical list?

I have a large .txt file for which I need to do some data analysis. I've been working on it for a while, and the analysis part has got faster and faster so that most of the evaluation time is now ...
2
votes
1answer
48 views

Importing files by date of creation

Much like this question, I am trying to import data from csv files based on date of creation. I am running Linux Mint and have a bash script that creates csv files every day with file name of the ...
3
votes
1answer
102 views

Get[…, Path-> {…}] does not shield against paclets directories

Let's create a test package/paclet in a standard $UserBaseDirectory/Applications: ...
4
votes
2answers
282 views

Adding a graphic to the beginning of an existing (.nb) notebook file

I want to prepend graphics (as generated by Plot) to an existing .nb notebook file, each new addition being placed as a new cell at the top of the notebook page. ...
0
votes
0answers
187 views

Export to a Relative Path [duplicate]

Suppose I have a folder 'work' with two subfolders 'mathematica' and 'figures'. The thing I ...
3
votes
0answers
40 views

Synchronize file access from different kernels?

Let's say we have two different notebooks note1.nb and note2.nb performing calculations on two different kernels simultaneously. ...