Created
July 17, 2017 08:47
-
-
Save gilou/ddcc7de96dbbf7d9921243da125e816f to your computer and use it in GitHub Desktop.
Originally oneliner to clean up snapshots in reverse order on a VirtualBox machine.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
VM_NAME="MyVM" | |
# Use tac to reverse list given by --machinereadble outut of VBoxManage. | |
# Get ID from the SnapshotUUID-1-1-1-1-1-1="76c627e3-1c0a-4d0c-b680-b4f1c6175dac" output | |
for snap in $(VBoxManage snapshot "$VM_NAME" list --machinereadable| grep '^SnapshotUUID' | tac - | sed 's/SnapshotUUID\(-[0-9-]\+\)\?="\([0-9a-f-]\+\)"/\2/g') ; do | |
echo "Deleting Snap $snap" ; VBoxManage snapshot "$VM_NAME" delete "$snap" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment