(
d1='-delete'
d2='-exec rm -rf {} \;'
find . -empty -type d \
-not -path '*/.git/*' \
-not -path '*/tests/*' \
-not -path './_my/*' \
-not -path './app/design/adminhtml/Magento' \
-not -path './app/design/frontend/Magento' \
-not -path './update/vendor/bin' \
-not -path './var/*' \
-not -path './vendor/*' \
$d1
(
o=(
'*-old'
'*_old'
'*bak'
'broken'
)
for i in "${o[@]}"; do
find . -iname "$i" -type d $d2
done
)
(
o=(
'*,'
'*-*old'
'*-back'
'*-bkp'
'*-bkp.*'
'*-disable'
'*-old'
'*.*bak'
'*.back'
'*.backup'
'*.bak'
'*.bak.*'
'*.bk'
'*.bkp'
'*.bkup*'
'*.modified'
'*.old'
'*.org'
'*.orig'
'*.original'
'*.original.*'
'*.phtml?*'
'*.sav'
'*.save'
'*.xml.before'
'*='
'*=bkp'
'*_bak.*'
'*_copy'
'*_new'
'*_original'
'*_prev'
'*_prev.css'
'*~'
'._*'
'Thumbs.db'
'['
'error_log'
'vssver2.scc'
)
for i in "${o[@]}"; do
find . -iname "$i" -type f $d1
done
)
find . -name '*-BK*' -type f $d1
find . -iname '*-org' -type f -not -path './pub/media/catalog/*' $d1
find . -iname '*.test' -type f -not -path '*/Test/*' -not -path '*/test/*' -not -path '*/tests/*' $d1
find . -iname '*_original.*' -type f -not -path './pub/media/catalog/*' $d1
find . -iregex '.*/[0-9]' -type f $d1
find . -iregex '.*\.[x]+' $d1
find . -iname '*_' -type d \
-not -path './media/*' \
-not -path './pub/media/*' \
-not -path './vendor/rector/*' \
$d2
find . -iname '*--*' -type f \
-not -path '*/images/*' \
-not -path './.well-known/*' \
-not -path './media/*' \
-not -path './pub/media/*' \
-not -path './var/cache/*' \
-not -path './var/log/*' \
-not -path './var/page_cache/*' \
$d1
find . -iname '*-' \
-not -path './media/*' \
-not -path './pub/media/*' \
$d2
find . -iname '.DS_Store' -type f -not -path './vendor/shopialfb/*' $d1
find . -iname '_*' -type d \
-not -path '*/_' \
-not -path '*/__MACOSX' \
-not -path '*/__snapshots__' \
-not -path '*/_cache' \
-not -path '*/_data' \
-not -path '*/_envs' \
-not -path '*/_file' \
-not -path '*/_files' \
-not -path '*/_fixture' \
-not -path '*/_module' \
-not -path '*/_modules' \
-not -path '*/_notes' \
-not -path '*/_support' \
-not -path './_my' \
$d2
find . -iname '.*' -type d \
-not -path '*/.*ci' \
-not -path '*/.cache' \
-not -path '*/.config' \
-not -path '*/.dot_directory' \
-not -path '*/.easymin' \
-not -path '*/.git*' \
-not -path '*/.phive' \
-not -path '*/.phpdoc' \
-not -path '*/.platform' \
-not -path '*/.psalm' \
-not -path '*/.renditions' \
-not -path '*/.scenarios.lock*' \
-not -path '*/.well-known' \
-not -path '*/vendor/symfony/finder/Tests/Fixtures/.dot' \
-not -path './media/wysiwyg/.thumbs' \
-not -path './node_modules/.bin' \
-not -path './pub/media/*.thumb*' \
-not -path './pub/media/.template-manager' \
-not -path './pub/media/.tmb' \
$d2
find . -iname __MACOSX $d2
ext='\(bak\|css\|js\|json\|html\|inc\|less\|php\|phtml\|txt\|xml\)'
ext1='\(bak\|css\|js\|json\|html\|inc\|less\|php\|phtml\|xml\)'
ext2='\(bak\|css\|js\|json\|html\|inc\|php\|phtml\|xml\)'
find . -iregex '.*[-_]+[0-9][0-9][0-9\._-]+\.'$ext1'$' -type f \
-not -name 'moment-timezone-with-data-2012-2022.js' \
-not -name 'olegnax_athlete2_login_recaptcha_msp_231.xml' \
-not -name 'subs_win-1252.php' \
-not -path '*/Test/*' \
-not -path '*/Tests/*' \
-not -path '*/Zend/Locale/Data/*' \
-not -path '*/data/*_setup/*' \
-not -path '*/i18n/*' \
-not -path '*/sql/*_setup/*' \
-not -path '*/tests/*' \
-not -path './pub/media/pdftemplates/files/*' \
-not -path './skin/frontend/indigo/default/css/grid_*.css' \
-not -path './vendor/rector/rector/vendor/rector/*/config/sets/*' \
-not -path './vendor/symfony/intl/Resources/data/*' \
-not -path './vendor/web-token/jwt-framework/src/EncryptionAlgorithm/Experimental/ContentEncryption/*' \
$d1
find . -iregex '.*[-_]+[0-9][0-9][0-9\._-]+\-\w+\.'$ext1'$' -type f \
-not -path './var/*' \
$d1
find . -iregex '.*/_[^/]+\.'$ext2'$' -type f \
-not -path '*/Test/*' \
-not -path '*/iconpanels/_options.js' \
-not -path '*/tests/*' \
-not -path '*/vendor/fidry/cpu-core-counter/src/Finder/_NProcessorFinder.php' \
-not -path '*testing*' \
-not -path './app/design/frontend/Codazon/fastest/seavus/Magento_Email/email/*' \
-not -path './node_modules/*' \
-not -path './pub/media/amazon/*' \
-not -path './pub/media/codazon/themelayout/*.less.css' \
-not -path './vendor/mage2pro/core/Payment/Settings/_3DS.php' \
-not -path './vendor/magento/framework/Phrase/*' \
-not -path './vendor/mrclay/minify/builder/_index.js' \
$d1
find . -iregex '.*/[^/]+_\.'$ext'$' -type f \
-not -path '*/vendor/nikic/php-parser/*' \
-not -path './app/code/Inchoo/Search/Controller/Results/*' \
-not -path './node_modules/*' \
-not -path './update/vendor/phpdocumentor/*' \
-not -path './vendor/magento/framework/Phrase/*' \
-not -path './vendor/phpdocumentor/*' \
-not -path './vendor/psy/psysh/src/Reflection/ReflectionConstant_.php' \
$d1
find . -iregex '.*[_\.]backup\.'$ext'$' -type f $d1
find . -iregex '.*[_\.]bkp\.'$ext'$' -type f $d1
find . -iregex '.*[_\.]old\.'$ext'$' -type f \
-not -path './app/code/Mageplaza/Shopbybrand/view/adminhtml/templates/catalog/product/attribute/*' \
-not -path './dev/tests/*' \
-not -path './lib/web/mage/*' \
-not -path './pub/static/*' \
-not -path './vendor/magento/magento2-base/*' \
-not -path './vendor/mageplaza/magento-2-shop-by-brand/view/adminhtml/templates/catalog/product/attribute/*' \
$d1
find . -iregex '.*[_\.]orig\.'$ext'$' -type f $d1
find . -iregex '.*\.'$ext'(.*' -type f $d1
find . -iregex '.*\.'$ext'\..* .*' -type f $d1
find . -iregex '.*\.'$ext'[0-9\._-]+$' -type f \
-not -path '*/.git/*' \
-not -path '*/mkcss/*' \
$d1
find . -iregex '.*\.'$ext'BKP$' -type f $d1
find . -iregex '.*\.'$ext'[_\.-]backup$' -type f $d1
find . -iregex '.*\.'$ext'\.swp$' -type f $d1
find . -iregex '.+[^/]+\.[^/\.]*[-_]+[^/\.]*$' -type f \
-not -path '*/mkcss/*' \
-not -path '*_mst_ORIG' \
-not -path '*_mst_TMP' \
$d1
rm -rf ./app/app
rm -rf ./generated_
bin/magento cache:clean
)