MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Bare Bones Backup Button

This is something I've wanted for years. Click the button, and a copy  
of the current InputNotebook -- with output cells deleted -- is  
Exported into a backup folder in your $HomeDirectory.

Button["Bare Bones Backup",
    Module[{filename, thisnb = InputNotebook[]},
     If[thisnb =!= $Failed,
      CreateDirectory[ToFileName[{$HomeDirectory, "MathBackups"}]];
      filename =  StringJoin[
        StringReplace[(WindowTitle /. AbsoluteOptions[thisnb]),
         s_ ~~ ".nb" -> s], "_",
          StringJoin[ToString /@ Round /@ Rest[Date[]]], ".nb"];
      Export[ToFileName[{$HomeDirectory, "MathBackups"}, filename],
       DeleteCases[NotebookGet[thisnb], Cell[_, "Output", ___],  
      ] ] ] ] ]

(Button is new to 6, but the function inside Button should work fine  
in 5.2.)

I've got a version of this that runs automatically every 15 minutes  
(you can change the interval, of course). Anyone who's interested  
should let me know.

Selwyn Hollis

  • Prev by Date: Re: Re: Re: Re: Re: v6: still no multiple undo?
  • Next by Date: Re: Re: Hotkeys - redefine
  • Previous by thread: Re: Re: Re: Re: Re: v6: still no multiple undo?
  • Next by thread: Re: Bare Bones Backup Button