Skip to content

Instantly share code, notes, and snippets.

@rixth
Created December 11, 2012 05:13
Show Gist options
  • Select an option

  • Save rixth/4256064 to your computer and use it in GitHub Desktop.

Select an option

Save rixth/4256064 to your computer and use it in GitHub Desktop.

Revisions

  1. rixth created this gist Dec 11, 2012.
    21 changes: 21 additions & 0 deletions function.zsh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,21 @@
    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
    }