New answers tagged files-and-directories
8
If you use Import/Export to load/save .mx files, instead of DumpSave, then the variable does not get embedded in the file, and you can assign it to any variable of choice in the new session.
x = RandomReal[1, {100, 100}];
Export["~/tmp.mx", x];
y = Import["~/tmp.mx"];
x == y
(* True *)
13
I think you can use Names["Global*"]` to get the name:
a = RandomReal[{0, 1}, 10];
SetDirectory[$TemporaryDirectory];
DumpSave["1.mx", a];
Quit[]
SetDirectory[$TemporaryDirectory];
<< 1.mx
Names["Global`*"]
(*{"a"}*)
1
A rough straightforward implementation is to find all of the subpaths in your path, and generate a button that allows setting a new path at that level for each such subpath. Here's an implementation that generates the list of files/folders when you press the menu to ensure it's up to date.
pathParts[path_] := ...
1
My solution is only prototype but I'll update it later. It differs from Yours approach becouse my function is blind. A priori it does not know the structure of file's tree.
And there is also ActionMenu not PopupMenu. :(
This version is not very elegant but I'm going to improve this.
Lets start and set main directory and create function for each menu:
dir ...
3
To choose the directory interactively, use SystemDialogInput, which brings up a native dialog
SystemDialogInput["Directory"]
If successful, it'll return the chosen directory as a string, or return $Canceled if you select "Cancel".
Top 50 recent answers are included
