#!/bin/bash for ID in $(vboxmanage list hdds | grep '^UUID:' | cut -c14-) do vboxmanage modifyhd $ID --compact done