Skip to content

Instantly share code, notes, and snippets.

@allysonsouza
Created January 29, 2019 18:05
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 allysonsouza/e8b4f87879cca1f418a1e3b8f45e7689 to your computer and use it in GitHub Desktop.
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
:: 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