DumpSave'ing while lengthy program runs

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
6
down vote

favorite












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.



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]






share|improve this question






















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














up vote
6
down vote

favorite












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.



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]






share|improve this question






















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












up vote
6
down vote

favorite









up vote
6
down vote

favorite











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.



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]






share|improve this question














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.



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]








share|improve this question













share|improve this question




share|improve this question








edited Aug 30 at 8:30









Johu

2,461827




2,461827










asked Aug 29 at 14:29









Gladaed

777




777











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
















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















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




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










2 Answers
2






active

oldest

votes

















up vote
6
down vote



accepted










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






share|improve this answer



























    up vote
    5
    down vote













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





    share|improve this answer




















      Your Answer




      StackExchange.ifUsing("editor", function ()
      return StackExchange.using("mathjaxEditing", function ()
      StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix)
      StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
      );
      );
      , "mathjax-editing");

      StackExchange.ready(function()
      var channelOptions =
      tags: "".split(" "),
      id: "387"
      ;
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function()
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled)
      StackExchange.using("snippets", function()
      createEditor();
      );

      else
      createEditor();

      );

      function createEditor()
      StackExchange.prepareEditor(
      heartbeatType: 'answer',
      convertImagesToLinks: false,
      noModals: false,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: null,
      bindNavPrevention: true,
      postfix: "",
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      );



      );













       

      draft saved


      draft discarded


















      StackExchange.ready(
      function ()
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f180849%2fdumpsaveing-while-lengthy-program-runs%23new-answer', 'question_page');

      );

      Post as a guest






























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes








      up vote
      6
      down vote



      accepted










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






      share|improve this answer
























        up vote
        6
        down vote



        accepted










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






        share|improve this answer






















          up vote
          6
          down vote



          accepted







          up vote
          6
          down vote



          accepted






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






          share|improve this answer












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







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Aug 29 at 14:35









          Henrik Schumacher

          36.7k249103




          36.7k249103




















              up vote
              5
              down vote













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





              share|improve this answer
























                up vote
                5
                down vote













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





                share|improve this answer






















                  up vote
                  5
                  down vote










                  up vote
                  5
                  down vote









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





                  share|improve this answer












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






                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Aug 29 at 14:35









                  Johu

                  2,461827




                  2,461827



























                       

                      draft saved


                      draft discarded















































                       


                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f180849%2fdumpsaveing-while-lengthy-program-runs%23new-answer', 'question_page');

                      );

                      Post as a guest













































































                      Comments

                      Popular posts from this blog

                      What does second last employer means? [closed]

                      Installing NextGIS Connect into QGIS 3?

                      One-line joke