Skip to content

Instantly share code, notes, and snippets.

@voronkovich
Created August 9, 2014 15:23
Show Gist options
  • Save voronkovich/22bd9d2cd5461f255531 to your computer and use it in GitHub Desktop.
Save voronkovich/22bd9d2cd5461f255531 to your computer and use it in GitHub Desktop.
Moving MODx to another directory
#!/usr/bin/env sh
#
# Launch this script in a new MODx directory
#
old_path=$(sed -ne "s/^.*\\\$modx_base_path[[:space:]]*=[[:space:]]*'\\(.*\\)';.*$/\\1/p" core/config/config.inc.php)
new_path=$(readlink -f ${2:="."} 2&>/dev/null)
for file in $(grep -lR --exclude-dir="cache" $old_path * 2&> /dev/null)
do
sed -nie "s/$old_path/$new_path\/" $file
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment