From Wikipedia: On July 30, 1864, Brigadier General John McCausland and 2,800 Confederate cavalrymen entered Chambersburg and demanded $100,000 in gold or $500,000 in greenbacks. The residents of Chambersburg failed to raise the ransom, and McCausland ordered his men to burn the town. Flames destroyed more than 500 structures leaving more than 2,000 homeless. One resident died of smoke inhalation. Damage was estimated at more than $1.6 million. To make matters worse, many inebriated Confederate soldiers looted homes and abused civilians. Mobs of angry townspeople looking for retribution killed several Rebels.
Union cavalry, including the 22nd Pa, pursued the retreating Confederates as the carried their loot southward. The 22nd Pa was sent down and around the rebel camps near Moorefield, WV so that it would be in place behind them as a blocking force and to capture any of the enemy retreating after the attack that would be executed early in the morning of August 7.
On the night of August 6, 1864 Gen.Averell's Union cavalry cautiously moved toward the Confederate camps. Using an advance guard disguised as Confederate soldiers, Averell's cavalry quietly captured all of the Confederate pickets that separated the Union force from the sleeping Confederates. On the early morning of August 7, Averell's first brigade attacked the Confederate brigade camped on the north side of the river. Many of these rebels were sleeping and did not have their horses saddled. In some cases, entire Confederate regiments simply tried to run away, leaving behind weapons and loot taken from Chambersburg. Although the Confederates attempted to offer resistance on the south side of the river that separated the two Confederate camps, many of those men were also caught unprepared. Averell added his second brigade to the fight, and it charged across the river. The disorganized Confederate force was no match for Averell's cavalry, which was armed with sabers, 6-shot revolvers (hand guns) and 7-shot repeating rifles. Over 400 men were either killed or captured, while the Union force lost less than 50. Averell's victory inflicted permanent damage on the Confederate cavalry, and it was never again the dominant force it once was in the Shenandoah Valley.
On the 7th of August General Averell attacked the Confederates at Moorefield early in the morning, completely surprising and routing his entire command. When Work heard Averell's guns he pushed forward his command. Soon the enemy began coming down the road toward us and we were in the midst of the fray. Major Work with his one hundred men took them by detail, until we had about all we could manage. A Confederate major requested Work to send him to the rear. Work replied that he would later. When we were nearing Moorefield this same Confederate remarked to Major Work, "You didn't do what you promised me." Work replied, "What was that?" "You said you would send me to the rear and you failed to do it. ' ' Work laughingly replied, "I sent you as far to the rear as my jurisdiction went." When the Confederate looking around said, "You don't mean to tell me this is all the men you have." Work replied, "Yes sir; don't you think they did their work well?" Work captured four officers, two captains and more men than he had in his command, be sides one hundred and eight horses and two mules.