Skip to content

Instantly share code, notes, and snippets.

@brankoajzele
Created August 21, 2020 09:01
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 brankoajzele/c352852f3b12d4d347e7a97646877f34 to your computer and use it in GitHub Desktop.
Save brankoajzele/c352852f3b12d4d347e7a97646877f34 to your computer and use it in GitHub Desktop.
Recursively replace spaces with underscores in file name
find pub/media/catalog/product -depth -name '* *' -type f | while IFS= read -r f ; do mv -i "$f" "$(dirname "$f")/$(basename "$f"|tr ' ' _)" ; done
@brankoajzele
Copy link
Author

brankoajzele commented Aug 21, 2020

To be executed from the Magento's root directory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment