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:

data = initializeDataSet[] 
DumpSave['save0', data]

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


resultn = computen[]
DumpSave['saven', 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.

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:

names = FileNames[pattern,{directory}]
Do[Get[fileName], {fileName, names}]
  • $\begingroup$ please add you solution as an answer rather than part of the question? $\endgroup$
    – chris
    Aug 30, 2018 at 8:45

2 Answers 2


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

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.