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.

Filter by
Sorted by
Tagged with
7
votes
3answers
283 views

Making a Dataset that emulates `ls -tlra`?

When we ls -tlra in bash, we get filename information, size of files, date last modified, etc. Is there a way to create a Mathematica function which generates a ...
5
votes
1answer
67 views

Find image dimensions without importing the full image?

Is there a way to find the ImageDimensions of an image file without Import'ing each one? The reason being that I have a ...
2
votes
1answer
102 views

Using Open with a filename that contains “:”

I am writing some data to a .txt file. I am using Open[] to create the text file in the directory I want and then Write[] and WriteString[]. (I am using FileNameJoin[] to create the actual filenames). ...
7
votes
3answers
820 views

Better random (unique) file name

In order to avoid conflict with file names produced by some code running in multiple instances of Mathematica I append the date and a random string at the end hoping to create a unique filename. The ...
0
votes
4answers
61 views

How to leavy only numerical data in the file?

Consider a file. Apart from an information which is non-relevant for me, it contains blocks <event></event> with the numerical data inside. Is there a ...
1
vote
1answer
44 views

How to download an archive or directory from Wolfram Cloud?

I don't own Mathematica, but have a (free) Wolfram Cloud account. I'd like to download all of the files in a given Wolfram Cloud directory to my computer. I've used ...
0
votes
2answers
36 views

Change input filename according to ticker

I want to import a series of files with similar filenames that change according to a "ticker". An example is filenames A1_data.dat, ...
6
votes
0answers
96 views

Problem with my user name

I'm trying to use the new website ("Wolfram Function Repository") and i get the following error: ...
2
votes
0answers
33 views

How to efficiently flatten folders?

I have 100 folders each with 1 million images, is there any (efficient) Mathematica command to flatten them into a single folder with 100 million files? Iterating and doing CopyFile and DeleteFile ...
1
vote
0answers
82 views

How to open Mathematica files from 1989 with “.bo” extension

I have access to a collection of files from 1989, which appear to have been written for an early version of Mathematica. I was curious if anyone knows how I might open and read these files in ...
2
votes
0answers
46 views

Concise way to set input directory

Got this Mathematica ResNet- 50 Code online and has been trying to make run it using the same data set but it seems my directories to the dataset were not correct, keep getting this error: ...
3
votes
1answer
56 views

Is there a tool for editing the spelling dictionary?

Is there a tool for editing the spelling dictionary? Now that MMA 12 does spellchecking on the fly, I've been using it. And of course, as I was wondering how I might delete a word accidentally added ...
1
vote
0answers
57 views

Write in ParallelTable

Why does ...
0
votes
0answers
69 views

Notebook file corruption

For the last few years the beginning of Mathematica notebook files on my computers have been frequently corrupted (Mathematica 11.x on Windows). If I open them with Windows Notepad the first line or ...
3
votes
1answer
68 views

Retrieve File Dates for Files Inside an Archive (ZIP)

Suppose I have a zip archive file with many files in it. I can get a list of the files in the archive with: Import["zipfile.zip"] I can get data out of one of ...
1
vote
0answers
47 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
36 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
39 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
184 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
95 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
71 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] ...
5
votes
1answer
60 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
87 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
57 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
180 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
44 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
27 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
43 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
215 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
118 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
64 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
51 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
83 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
136 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
37 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
2k 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
52 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 ...
6
votes
1answer
320 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
710 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
58 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
29 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
40 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
80 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
41 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
150 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
24 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 ...
7
votes
1answer
150 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 ...