|Re: HP49G+. How to erase a directory that contains lots of stuff?|
Message #3 Posted by James M. Prange (Michigan) on 15 Dec 2007, 4:28 p.m.,
in response to message #1 by J.C.Boco
Is there a way to purge a Directory, even if the directory has
gobs of stuff in it? I figure all I have to do is purge just one
directory (Thermo or Fluids or Statics), any folder with big hunky
equations will do. Then I can just do the RESTORE thing.
Of course, to do a RESTORE, you do have to have enough free memory
to put the backup object on the stack first.
As you've noted, CLUSR (synonym for CLVAR) and, for that matter,
PURGE won't purge non-empty subdirectories.
To purge non-empty subdirectories (including any "descendent"
subdirectories), you can use the PGDIR command. PGDIR, depending
on the structure of the subdirectory, can be rather slow, as it
"crawls" the branch into the lowest subdirectories, and after all
subdirectories at that level have been emptied, moves up the path
to the next higher directory and does the same thing, until it's
finished purging the target subdirectory.
Note that both PURGE and PGDIR can take either a name or a list of
names for their argument.
A program to purge everything (except the hidden subdirectory)
HOME @ Make home directory current.
15 TVARS @ Get the list of subdirectories.
PGDIR @ Purge the subdirectories (empty or not).
CLVAR @ Purge everything else.
But if you intend to do a RESTORE, it may be faster to clear all
memory first. RESTORE starts out by doing what amounts to a PGDIR
on the home directory, so will purge all variables (and
To clear all user memory more quickly, hold down the ON key while
pressing the A and F keys, then release first the F key, and then
the A and ON keys. This gets you to the TTRM (Try To Recovery
Memory?) display. If you respond YES, then it will check for
memory corruption and recover as much as it can (which may take a
lot of time), and if you respond NO, then it will clear all user
A possible disadvantage to clearing all memory is that all modes
will be restored to their default states. For the modes that are
controlled by flags, you can have a list of flags (retrieved by
the RCLF command) included in a variable within the archive and,
after doing a RESTORE, restore the flags with the STOF command.
But some modes aren't controlled by flags, and those you'd have to
take care of yourself.
For the 49 series, the PUSH command will store the current path
and flags lists in the reserved variable ENVSTACK (in the CASDIR
subdirectory), which would be included in an archive, and the POP
command will retrieve the most recent path and flags list and
Note that the RESTORE ends with a warmstart, which clears flag -62
(forcing USER keyboard mode off), but doesn't affect any other
Edited: 15 Dec 2007, 6:56 p.m. after one or more responses were posted