DumpSave'ing while lengthy program runs

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:


Get['lib.wl']
data = initializeDataSet
DumpSave['save0', data]

result1 = compute1
DumpSave['save1', result1]
Clear[result1]

.
.
.

resultn = computen
DumpSave['saven', resultn]
Clear[resultn]



is there a good way to load all saves without going >>save0 to >>saven. Or is this manual work needed? A Get[name] where name allows for joker would suffice, but I don't think it exists. Putting them into a separate folder seems sensible.


Get[name]



Just saving at the end doesn't seem viable/safe to me in case of an unexpected early exit.



Edit: just discovered FileNames is a thing.
the solution would be like:


FileNames


names = FileNames[pattern,directory]
Do[Get[fileName], fileName, names]





please add you solution as an answer rather than part of the question?
– chris
Aug 30 at 8:45




2 Answers
2



You can use Get/@ FileNames["save*"].


Get/@ FileNames["save*"]


Get /@ StringTemplate["save``"] /@ Range[1, 5]



Required, but never shown



Required, but never shown






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.