The long-term preservation of records is a seriously difficult problem if you assume that the processes that maintain records have fallen apart. It doesn't require nuclear war to destroy records; long-term negligence will do that quite easily enough. Even just a lack of basic gardening and structural upkeep will destroy a library, an archive, a computer — you only need a little bit of a water leak to encourage the growth of mold, plants, animals, and so on. Nature takes back abandoned land over a timescale of decades, and over a timescale of centuries it is ruthless. It is only through regular, methodical maintenance that we preserve things — ask anyone who works on facilities staff how much work it takes to keep a building from crumbling apart bit by bit.
Digital media is particularly poor at long-term preservation, because storage media degrades faster than most people realize. The way we preserve things now is by continuously copying the things we care about, an updated (and considerably easier, and higher-volume) version of what the book-copiers of the ancient and medieval world did. Paper stored in a desiccated place can last for a thousand years or more (such as the Dead Sea Scrolls) but no one believe a hard drive or CD-ROM is likely to be able to do that. Clay and rock tablets, again in a desiccated area, can also last a long time — they are our oldest sources of writing.
But the reason that we have so much of the Greek and Roman texts is not because they happened to be kept in a good storage area, but because people kept and copied them. The Byzantines and the Arab world are particularly credited for these acts of preservation, not out of the kindness of their hearts (or an interest in the future), but because they had elaborate social orders set up that encourage this kind of work.
Can we imagine a future preservation social order in the event of a near-collapse of the modern world? It's been done in fiction, for sure — this is essentially the conceit behind A Canticle for Leibowitz, a classic work of post-apocalyptic science fiction by Walter M. Miller Jr. from 1959. (If such speculations are interesting to you, I encourage you to read it, both for its own sake and as a window into the imagination of the high Cold War.)
But anyway, there is no easy answer to this, because it depends on exactly the scenario you are imagining. If all of our computers somehow winked out of existence (via debilitating electromagnetic pulses, for example), we would indeed lose a lot of "data," but how much of this is "history" is debatable, and much is still kept in non-digital form. But if human beings were reduced to some sort of small, scrabbling nucleus for several centuries (I am thinking of something like in Stephen King's The Stand, but maybe that is just the current state of the world creeping into my thoughts), the loss of written information would be much deeper, owing to the effect of negligence.