Как заархивировать сайт на Magento 2 с командной строки?

(Дмитрий Федюк) #1

Удаляем .DS_Store, __MACOSX и остальной мусор

find . -name ".DS_Store" -type f -delete
find . -name "*.MODIFIED" -type f -delete
find . -name "*.ORIGINAL" -type f -delete
find . -name "*.original" -type f -delete
find . -name "*.orig" -type f -delete
find . -name "*.old" -type f -delete
find . -name "*_prev" -type f -delete
find . -name "*.bak" -type f -delete
find . -name "*.bak.*" -type f -delete
find . -name "*.phtml_" -type f -delete
find . -name __MACOSX -exec rm -rf {} \;
rm -rf ./app/app

df.tips/t/858
df.tips/t/859

Поиск мусора и тяжёлых папок

du -csh ./* | sort -h -r 
find . -name "*.zip" -type f
find . -name "*.tgz" -type f
find . -name "*.tar.gz" -type f
find . -name "*.gz" -type f
find . -name "*.sql" -type f

Все файлы

tar -zcvf ../${PWD##*/}-$(date '+%Y-%m-%d-%H-%M').tgz .

Без ненужных для разработки папок

tar \
	-zcvf ~/${PWD##*/}-$(date '+%Y-%m-%d-%H-%M').tgz . \
	--exclude='*.gz' \
	--exclude='*.mp4' \
	--exclude='*.pdf' \
	--exclude='*.tgz' \
	--exclude='*.zip' \
	--exclude='./.git' \
	--exclude='./.github' \
	--exclude='./.sucuriquarantine' \
	--exclude='./.well-known' \
	--exclude='./__MACOSX' \
	--exclude='./cgi-bin' \
	--exclude='./dev' \
	--exclude='./generated' \
	--exclude='./node_modules' \
	--exclude='./pub/media/cache' \
	--exclude='./pub/media/captcha' \
	--exclude='./pub/media/catalog/product/cache' \
	--exclude='./pub/media/import' \
	--exclude='./pub/media/product/cache' \
	--exclude='./pub/media/tmp/catalog/product' \
	--exclude='./pub/static/*' \
	--exclude='./pub/ub-tool' \
	--exclude='./test' \
	--exclude='./var' \
	--exclude='./vendor/magento/magento2-base' \
	--exclude='./wp' \
	./pub/static/.htaccess \
	./var/composer_home/.htaccess \
	./var/composer_home/auth.json \
	./var/composer_home/packages.json

Без товарных картинок и ненужных для разработки папок

tar \
	-zcvf ~/${PWD##*/}-$(date '+%Y-%m-%d-%H-%M').tgz . \
	--exclude='*.gz' \
	--exclude='*.mp4' \
	--exclude='*.pdf' \
	--exclude='*.tgz' \
	--exclude='*.zip' \
	--exclude='./.git' \
	--exclude='./.github' \
	--exclude='./.sucuriquarantine' \
	--exclude='./.well-known' \
	--exclude='./__MACOSX' \
	--exclude='./cgi-bin' \
	--exclude='./dev' \
	--exclude='./generated' \
	--exclude='./node_modules' \
	--exclude='./pub/media/cache' \
	--exclude='./pub/media/captcha' \
	--exclude='./pub/media/catalog/product' \
	--exclude='./pub/media/import' \
	--exclude='./pub/media/product' \
	--exclude='./pub/media/tmp/catalog/product' \
	--exclude='./pub/static/*' \
	--exclude='./pub/ub-tool' \
	--exclude='./test' \
	--exclude='./var' \
	--exclude='./vendor/magento/magento2-base' \
	--exclude='./wp' \
	./pub/static/.htaccess \
	./var/composer_home/.htaccess \
	./var/composer_home/auth.json \
	./var/composer_home/packages.json

Для Magento 1

tar \
	-zcvf ../${PWD##*/}-$(date '+%Y-%m-%d-%H-%M').tgz . \
	--exclude='*.gz' \
	--exclude='*.mp4' \
	--exclude='*.pdf' \
	--exclude='*.tgz' \
	--exclude='*.zip' \	
	--exclude='./.git' \
	--exclude='./.github' \
	--exclude='./.sucuriquarantine' \
	--exclude='./.well-known' \
	--exclude='./__MACOSX' \
	--exclude='./cgi-bin' \
	--exclude='./dev' \
	--exclude='./includes/src' \
	--exclude='./media/catalog/product/cache' \
	--exclude='./media/js' \
	--exclude='./test' \
	--exclude='./var' \
	--exclude='./wp' 

Упаковка товарных картинок в многотомный архив RAR

cd pub/media/catalog
rar a -v500000k product.rar product -xproduct/cache
0 Likes

Часто используемая мной информация в едином месте