Created
January 29, 2019 18:05
-
-
Save allysonsouza/e8b4f87879cca1f418a1e3b8f45e7689 to your computer and use it in GitHub Desktop.
Script to move projects from folders and search-replace WordPress databases to reflect that change
This file contains 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
:: Name: haste status | |
:: Purpose: move Haste WordPress projects from folders | |
:: Author: @allysonsouza | |
:: URL: https://github.com/allysonsouza | |
:: Version: 0.0.1 | |
:: License: GPL-v2 | |
@ECHO OFF | |
SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION | |
SET me=%~n0 | |
SET interactive=0 | |
SET project=%1 | |
SET current=%2 | |
SET new=%3 | |
SET currentdir=C:\web\%current% | |
SET newdir=C:\web\%new% | |
SET command1=cd %currentdir%\%project% | |
SET command2=wp search-replace 127.0.0.1/Workspace/%current% 127.0.0.1/Workspace/%new% | |
ECHO %CMDCMDLINE% | FINDSTR /L %COMSPEC% >NUL 2>&1 | |
IF %ERRORLEVEL% == 0 SET interactive=1 | |
echo Moving directory... | |
cd "%newdir%" | |
move "%currentdir%\%project%" "%newdir%\%project%" | |
echo Doing search and replace in database... | |
cd "%project%" | |
%command1% | |
%command2% | |
IF "%interactive%"=="0" PAUSE | |
EXIT /B 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment