Last active
December 25, 2015 19:09
-
-
Save ryaan-anthony/7026244 to your computer and use it in GitHub Desktop.
1. Put this script in your /shell/ directory (from within magento root).2. Running the script will move all images to their respective directories, will create directories that do not exists.example:original: /media/catalog/product/ABC.jpg gets moved to: /media/catalog/product/A/B/ABC.jpg
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
| #!/bin/bash | |
| cd ~/public_html/media/catalog/product | |
| find . -maxdepth 1 -type f $1 | while read x; do | |
| filename=$(basename "$x") | |
| first=${filename:0:1}; | |
| second=${filename:1:1}; | |
| mkdir -p "$first/$second"; | |
| mv -f "$x" "$first/$second/$filename"; | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment