There have, and there's a very nice comprehensive article at Smithsonian.com detailing literal files in cakes and other escape tools:
The earliest case I found was recorded in an 1804 compendium of criminal behavior—and it’s an instance of successful use of cake as a means of securing freedom, albeit in a backhanded way. William Blewitt was a gang member known for his pickpocketing prowess and tendencies toward housebreaking. Sentenced to seven years for an undisclosed offense, Blewitt was placed aboard a prison ship where he learned that several felons procured saws and files by way of gingerbread cakes and were planning to escape before the ship set sail. Blewitt alerted the authorities to the plot and was pardoned.
This specific story also appears in
The Criminal Recorder: Or, Biographical Sketches of Notorious Public Characters, Including Murderers, Traitors, Pirates, Mutineers, Incendiaries ... and Other Noted Persons who Have Suffered the Sentence of the Law for Criminal Offenses ; Embracing a Variety of Curious and Singular Cases, Anecdotes, &c, Volume 1,
available online here:
William Blewitt, another of his gang, was the son of poor parents near Cripplegate, who apprenticed him to a glover; but before he had served above three years of his time, he associated with ill company, and became a pickpocket and house-breaker. Having been apprehended and lodged in Newgate, he was tried for an offence, of which he was convicted, and sentenced to be transported for seven years; in consequence of which he was put on board a ship in the river, in company with several other felons, Some of these had procured saws and files to be concealed in cakes of gingerbread, and by means of these instruments they hoped to effect their escape before the ship sailed to any distance. Blewitt having discovered their intention, disclosed it to the captain of the vessel, who seized the implements, and gave Blewitt his liberty, as a reward for the information.