@echo off
setlocal enabledelayedexpansion
REM 设置路径变量
set "to=E:\web\danzi\xxx3\web"
set "form=E:\web\danzi\xxx3\xxx\unpackage\dist\build\web"
echo 正在执行文件复制操作...
echo.
REM 检查源文件夹是否存在
if not exist "%form%" (
echo 错误:源文件夹不存在!
echo %form%
pause
exit /b 1
)
REM 检查目标文件夹是否存在
if not exist "%to%" (
echo 错误:目标文件夹不存在!
echo %to%
pause
exit /b 1
)
echo 1. 删除旧的 index.html 文件...
if exist "%to%\application\index\view\index\index.html" (
del "%to%\application\index\view\index\index.html"
echo 已删除旧文件
) else (
echo 文件不存在,无需删除
)
echo.
echo 2. 复制新的 index.html 文件...
if exist "%form%\index.html" (
REM 确保目标目录存在
if not exist "%to%\application\index\view\index" (
mkdir "%to%\application\index\view\index"
)
copy "%form%\index.html" "%to%\application\index\view\index\index.html"
echo 复制成功
) else (
echo 错误:源文件 %form%\index.html 不存在!
)
echo.
echo 3. 删除旧的 static 文件夹...
if exist "%to%\public\static" (
rmdir /s /q "%to%\public\static"
echo 已删除旧文件夹
) else (
echo 文件夹不存在,无需删除
)
echo.
echo 4. 复制新的 static 文件夹...
if exist "%form%\static" (
REM 确保目标目录存在
if not exist "%to%\public" (
mkdir "%to%\public"
)
xcopy "%form%\static" "%to%\public\static" /E /I /Y
echo 复制成功
) else (
echo 错误:源文件夹 %form%\static 不存在!
)
echo.
echo 操作完成!
pause
发表评论 取消回复