Most swarms have a speed of 20 ft, meaning that the standard humanoid character may run away from them with ease considering they have a 30 ft base movement speed.
Keep in mind that swarms are hundreds, if not thousands, of very small creatures. That is not something that even remotely sounds like something simple to handle for a mundane character. They are not used to creating explosions by snapping their fingers. As such, their most common reaction should be to get away from it and as fast as possible.
Depending on the size of the individual creature that form the swarm, they may take half damage from slashing and piercing weapons, and full damage from bludgeoning weapons:
A swarm made up of Tiny creatures takes half damage from slashing and piercing weapons. A swarm composed of Fine or Diminutive creatures is immune to all weapon damage.
So, a swarm of ravens (a Tiny creature) could be killed with swords and spears normally, with some difficulty. While you couldn't harm a swarm of spiders (a Diminutive creature) using such weapons.
You may improvise an explosive using lamp oil (1 sp) and fire:
You can also use a flask of lamp oil as a splash weapon. Use the rules for alchemist’s fire, except that it takes a full-round action to prepare a flask with a fuse. Once it is thrown, there is a 50% chance of the flask igniting successfully.
And you may also pour it on the ground and ignite:
You can pour a pint of oil on the ground to cover an area 5 feet square, provided that the surface is smooth. If lit, the oil burns for 2 rounds and deals 1d3 points of fire damage to each creature in the area.
Nearly all alchemical splash weapons are effective against swarms, as they deal damage in an area, and are especially effective against swarms:
A swarm takes half again as much damage (+50%) from spells or effects that affect an area, such as splash weapons and many evocation spells.
So, this would include acid flasks, alchemist fires, grenades and more. See the Alchemical Creations for a full list of them.
Try some repellent
If we are talking about a swarm of small insects, the Vermin Repellent (5 gp) may keep them off you:
This vile-smelling white paste keeps vermin at bay if spread on the skin. Normal-sized (Fine) vermin avoid you. Swarms of vermin must make a DC 15 Fortitude saving throw in order to enter your square. Once applied, vermin repellent remains effective for 4 hours or until you spend 1 round washing it off.