Toy Story 2 was one of the trickiest films Pixar ever produced. It was originally set to be a straight-to-DVD release (and video too), until the decision was made to go for a full cinema outing. But barely a year before release, the film was in trouble: as many at the firm were candidly appreciating, Toy Story 2 wasn't working.

John Lasseter, exhausted from directing Toy Story and A Bug's Life back to back, was asked to sort it out. He did—but the intensive year where the film was taken apart and put back together very much took its toll on Pixar. Changes were made in the aftermath of its hugely successful release.

Toy Story 2 had a happy ending for Pixar. It earned rave reviews, and took nearly $500m at the global box office.

And yet one command entered into a computer nearly derailed the entire project.

Writing in his book Creativity Inc, Pixar co-founder Ed Catmull recalled that in the winter of 1998, a year out from the release of Toy Story 2, somebody (he never reveals who in the book) entered the command '/bin/rm -r -f *' on the drives where the film's files were kept.

The object of said command is to remove everything from a given location, and to remove it quickly. It did its job.

"First, Woody's hat disappeared. Then his boots. Then he disappeared entirely," recalls Catmull. "Whole sequences—poof!—were deleted from the drive."

One of the film's technical directors, Oren Jacobs, watched it all happen in real time. His call to systems support started with him telling them to "pull out the plug on the Toy Story 2 master machine." When asked why by the person on the other end of the phone (a not-unreasonable question), Jacobs screamed "Please, God, just pull it out as fast as you can."

The plug was pulled, but not in time—90% of the film was gone, erased "in a matter of seconds."

And it got worse. A plan was quickly hatched to restore the data from a regular backup, which meant that only half a day of work would have been lost. But the backup system had failed. Pixar, incredibly, did not have a copy of the Toy Story 2 files on its servers. "To reassemble the film would have taken thirty people a solid year," Catmull recalled.

Toy Story 2 looked doomed.

Yet it was saved by something akin to blind luck. Galyn Susman was Toy Story 2's supervising technical director, and after she'd given birth to her second child, she'd been working from home. As such, once a week, she'd taken an entire copy of the film home with her.

A minute later, she was zooming home. Her computer was wrapped in blankets and put on the backseat of her car ("carefully"). In Oren's words, the computer was then "carried into Pixar like an Egyptian pharaoh."

While work had been lost, Susman's backup files limited the damage significantly. Furthermore, given the size of Pixar at the time—which was still years away from being the company big enough to merge with Disney—her computer may just have saved the firm (at least in the form that we know it). Unsurprisingly, Pixar put into place processes that stopped this ever happening again.

And, crucially, Toy Story 2 just about made its deadline.

This post originally appeared on our UK site.