Created
July 26, 2021 01:42
-
-
Save t2psyto/5bca28518f3fba736721d2f13d31d9c1 to your computer and use it in GitHub Desktop.
esxi vm clone
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
#!/bin/sh | |
echo "src: /vmfs/volumes/$1" | |
echo "dest: /vmfs/volumes/$2" | |
echo "machine: $3" | |
ls -l /vmfs/volumes/$1/$3/ | |
read -p "Press [Enter] key to continue." | |
mkdir /vmfs/volumes/$2/$3/ | |
# copy except "*.vmdk" | |
ls /vmfs/volumes/$1/$3/* | grep -v -e ".vmdk$" | xargs -I {} cp -p {} /vmfs/volumes/$2/$3/`basename {}` | |
# copy "*.vmdk" | |
ls /vmfs/volumes/$1/$3/*.vmdk | grep -v -e "-flat.vmdk$" | xargs -I {} vmkfs -i {} -d thin /vmfs/volumes/$2/$3/`basename {}` | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment