Skip to content

Instantly share code, notes, and snippets.

@peterjaap
Created September 22, 2021 11:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save peterjaap/c440ac9f7acfd331ffe526c9a82f65af to your computer and use it in GitHub Desktop.
Save peterjaap/c440ac9f7acfd331ffe526c9a82f65af to your computer and use it in GitHub Desktop.
Magento 2 - move duplicate themes files to new theme
#!/bin/bash
# Move duplicate themes files to new theme
OLDVENDOR="Vendor"
NEWVENDOR="Newvendor"
NEWTHEMENAME="Themename"
find app/design/frontend ! -empty -type f -exec md5sum {} + | sort | uniq -w32 -dD | cut -d' ' -f3 | while read a;
do
OLDTHEMENAME=$(echo $a | cut -d '/' -f5)
FILEPATH=$(echo $a | sed "s/${OLDVENDOR}/${NEWVENDOR}/" | sed "s/${OLDTHEMENAME}/${NEWTHEMENAME}/")
mkdir -p `dirname $FILEPATH`
cp $a $FILEPATH
rm $a
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment