Last active
April 30, 2021 19:06
-
-
Save abn/b10d00bca48934524dcc to your computer and use it in GitHub Desktop.
Convert all xz compressed raw images in current directory to vmdk and xz compress them.
This file contains hidden or 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
| find ./ -type f -name "*.raw.xz" \ | |
| -exec echo "Uncompressing {} ..." \; \ | |
| -exec unxz --keep {} \; \ | |
| -exec bash -c \ | |
| 'for file do | |
| INPUT_IMG=${file/.xz/} | |
| OUTPUT_IMG=${file/raw.xz/vmdk} | |
| echo "Converting to vmdk: ${INPUT_IMG}"; | |
| qemu-img convert -f raw -O vmdk ${INPUT_IMG} ${OUTPUT_IMG}; | |
| echo "Compressing ..."; | |
| xz --compress --verbose ${OUTPUT_IMG}; | |
| rm --force ${INPUT_IMG}; | |
| done' -- {} \; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment