Skip to content

Instantly share code, notes, and snippets.

@rixth
Created December 11, 2012 05:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rixth/4256064 to your computer and use it in GitHub Desktop.
Save rixth/4256064 to your computer and use it in GitHub Desktop.
A shell function to duplicate a VMWare Fusion 5 virtual machine, including renaming the innards.
function duplicate_vm() {
local from_name=$1
local to_name=$2
cp -r $from_name.vmwarevm $to_name.vmwarevm
pushd $to_name.vmwarevm > /dev/null
rm vmware*.log
mv $from_name.nvram $to_name.nvram
mv $from_name.plist $to_name.plist
mv $from_name.vmsd $to_name.vmsd
mv $from_name.vmx $to_name.vmx
mv $from_name.vmxf $to_name.vmxf
sed -i '' "s/$from_name/$to_name/" $to_name.vmxf
sed -i '' "s/$from_name/$to_name/" $to_name.vmx
sed -i '' "s/$from_name/$to_name/" $to_name.plist
popd > /dev/null
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment