How to share folder from Windows to Ubuntu in VirtualBox

On Windows, I sometimes run Ubuntu inside a VirtualBox virtual machine. I find that sharing a folder from Windows to Ubuntu is a convenient method of sharing files between the host and guest OS. Doing this is easy:

Choose Add Share. Choose the Folder Path to the directory you want to share. Note down the Folder Name displayed. This name will be used inside Ubuntu, so change it if you want. Check the Auto-mount option to have Ubuntu mount this directory whenever it starts up.

Power up the Ubuntu virtual machine. Your foo shared folder will be accessible in /media/sf_foo directory.