@echo off
setlocal
set "folderPath=D:\projects\cloudsignapp\app\src\main\assets\apps\__UNI__BCD1716\www"
if exist "%folderPath%" (
echo Deleting files in %folderPath%...
del /q "%folderPath%\*.*"
for /d %%d in ("%folderPath%\*.*") do rmdir /s /q "%%d"
echo Files deleted successfully.
) else (
echo Folder does not exist: %folderPath%
)
set "sourceFolder=D:\projects\cloudsign-uni\dist\dev\app"
set "destinationFolder=D:\projects\cloudsignapp\app\src\main\assets\apps\__UNI__BCD1716\www"
if exist "%sourceFolder%" (
if not exist "%destinationFolder%" mkdir "%destinationFolder%"
echo Copying files and folders from %sourceFolder% to %destinationFolder%...
xcopy /s /e /i "%sourceFolder%\*" "%destinationFolder%"
echo Files and folders copied successfully.
) else (
echo Source folder does not exist: %sourceFolder%
)
if exist "%sourceFolder%" (
echo Deleting files in %sourceFolder%...
del /q "%sourceFolder%\*.*"
for /d %%d in ("%sourceFolder%\*.*") do rmdir /s /q "%%d"
echo Files deleted successfully.
) else (
echo Folder does not exist: %sourceFolder%
)
pause
endlocal
具体流程就是先删除目标文件夹下面的所有文件(包含子文件夹)
然后复制过来
然后删除原文件夹下面所有文件