Post Reply 
Little explorations with HP calculators (no Prime)
06-15-2017, 01:09 PM (This post was last modified: 06-15-2017 01:30 PM by pier4r.)
Post: #224
RE: Little explorations with the HP calculators
I would like to share a simple program for backup up a directory from home to the SD card.

The examples that I found on this site (search string sd backup) use heavily the stack - while I like named variables, especially for things that do not have to be fast - and do not use the sdlib included with the sdfiler.

Since I would have liked to see an example with a different layout and I did not find it, I share mine to raise the chances that a reader, for example me in the future, can have another idea.

The program is far from being general, it is just an example how a backup program can be done.


  @it requires the sdfiler/sdlib library 
    "LIFEGDIR" "fileStrDos" DROP
    "" "dateStr" DROP
    "" "timeStr" DROP
    "" "sdDirStr" DROP
    @local var
      -42 SF
        @time does not need the flag -41
      DATE \->STR "." "" SREPL 
      DROP @we don't want to know the number of replacements
      'dateStr' STO
      @Now we need to "roll" the data instead of 15062017 we want
      @20170615 further we need to know that we dates with trailing
      @zeroes the tailing zero is lost
        dateStr SIZE 8 \=/
        'dateStr' 0 STO+
      dateStr 5 8 SUB @year
      dateStr 3 4 SUB + @month
      dateStr 1 2 SUB + @day
      'dateStr' STO
      TIME \->STR "." "" SREPL DROP
      'timeStr' STO
      timeStr 1 2 SUB @hours
      timeStr 3 4 SUB @min
      timeStr 5 6 SUB @seconds
      + + @concatenate
      'timeStr' STO
      @'fileStr' dateStr STO+
        @we cannot make this now, it cannot be done by the RPL filer
      {HOME LIFEG} RCL      
        @put the object in memory 
        @(problem, when the memory does not have enough space to duplicate an object on the stack)
      3 \->TAG
      STO @stores it on the sd  
      @rename the file on the SD using the library
      'fileStr' dateStr STO+
      'fileStr' timeStr STO+
         @longfilename with all those info
      @now moving it in the right directory on the sd
      "LIFEGDATABACKUP/B" dateStr + 'sdDirStr' STO
      @sdDirStr SDMKDIR
        @I need to handle the message, luckly the sdlib has also commands that
        @are less strict
      sdDirStr XMKDIR DROP
        @creates the folder, if already existing, it does not fail.
        @this is valid for multiple backups in a day
      sdDirStr "/" + fileStr +

Other useful topics that I found (but based heavily on stack operations):

(maybe the comp.sys.hp48 is a better archive for RPL questions , especially reading messages from 2010 or before, sometimes people address that newsgroup . Searching for sd backup)
- ok maybe this program from this page may help
-!search...7AI-5vHWQJ this is the discussion about the sdfiler from TW and Claudio L. themselves.

Wikis are great, Contribute :)
Find all posts by this user
Quote this message in a reply
Post Reply 

Messages In This Thread
RE: Little explorations with the HP calculators - pier4r - 06-15-2017 01:09 PM

User(s) browsing this thread: 1 Guest(s)