After a while, your ledger can get to be pretty large.  While this
will not slow down the ledger program much---it's designed to process
ledger files very quickly---things can start to feel ``messy''; and
it's a universal complaint that when finances feel messy, people avoid
them.

Thus, archiving the data from previous years into their own files can
offer a sense of completion, and freedom from the past.  But how to
best accomplish this with the ledger program?  There are two commands
that make it very simple: @command{print}, and @command{equity}.

Let's take an example file, with data ranging from year 2000 until
2004.  We want to archive years 2000 and 2001 to their own file,
leaving just 2003 and 2004 in the current file.  So, use
@command{print} to output all the earlier transactions to a file called
@file{ledger-old.dat}:

@smallexample
ledger -f ledger.dat -b 2000 -e 2001 print > ledger-old.dat
@end smallexample

To delete older data from the current ledger file, use @command{print}
again, this time specifying year 2002 as the starting date:

@example
ledger -f ledger.dat -b 2002 print > x
mv x ledger.dat
@end example

However, now the current file contains @emph{only} postings from
2002 onward, which will not yield accurate present-day balances,
because the net income from previous years is no longer being tallied.
To compensate for this, we must append an equity report for the old
ledger at the beginning of the new one:

@example
ledger -f ledger-old.dat equity > equity.dat
cat equity.dat ledger.dat > x
mv x ledger.dat
rm equity.dat
@end example

Now the balances reported from @file{ledger.dat} are identical to what
they were before the data was split.

How often should you split your ledger?  You never need to, if you
don't want to.  Even eighty years of data will not slow down ledger
much---and that's just using present day hardware!  Or, you can keep
the previous and current year in one file, and each year before that
in its own file.  It's really up to you, and how you want to organize
your finances.  For those who also keep an accurate paper trail, it
might be useful to archive the older years to their own files, then
burn those files to a CD to keep with the paper records---along with
any electronic statements received during the year.  In the arena of
organization, just keep in mind this maxim: Do whatever keeps you
doing it.