@echo off setlocal enabledelayedexpansion echo QDR Temporary Shared Storage Plugin Packager echo =========================================== echo. :: Set variables set PLUGIN_NAME=qdr-temporary-shared-storage set DEPLOY_DIR=D:\Deploy set CURRENT_DIR=%CD% set TARGET_ZIP=%DEPLOY_DIR%\%PLUGIN_NAME%.zip set SCRIPT_NAME=%~nx0 :: Create deploy directory if it doesn't exist if not exist "%DEPLOY_DIR%" ( echo Creating deploy directory %DEPLOY_DIR%... mkdir "%DEPLOY_DIR%" ) :: Remove existing ZIP if it exists if exist "%TARGET_ZIP%" ( echo Removing existing archive... del "%TARGET_ZIP%" ) :: Create temporary directory structure for packaging set TEMP_DIR=%TEMP%\%PLUGIN_NAME%_package set PLUGIN_TEMP_DIR=%TEMP_DIR%\%PLUGIN_NAME% :: Clean up any existing temporary directories if exist "%TEMP_DIR%" rmdir /s /q "%TEMP_DIR%" mkdir "%TEMP_DIR%" mkdir "%PLUGIN_TEMP_DIR%" echo Copying plugin files to temporary directory... :: Copy all files and directories except excluded ones for /d %%D in (*) do ( if /i not "%%D"=="@documentation" ( if /i not "%%D"=="@client" ( xcopy "%%D" "%PLUGIN_TEMP_DIR%\%%D\" /E /I /H /Y >nul ) ) ) :: Copy individual files except the script itself for %%F in (*.*) do ( if /i not "%%F"=="%SCRIPT_NAME%" ( copy "%%F" "%PLUGIN_TEMP_DIR%\" >nul ) ) echo Creating ZIP archive... :: Create ZIP file using PowerShell (this will include the plugin directory) powershell -Command "Add-Type -AssemblyName System.IO.Compression.FileSystem; [System.IO.Compression.ZipFile]::CreateFromDirectory('%TEMP_DIR%', '%TARGET_ZIP%')" :: Clean up temporary directories rmdir /s /q "%TEMP_DIR%" :: Verify creation and display result if exist "%TARGET_ZIP%" ( echo. echo Package created successfully: %TARGET_ZIP% echo Size: for %%A in ("%TARGET_ZIP%") do echo %%~zA bytes ) else ( echo. echo ERROR: Failed to create package! ) echo. echo Process complete. endlocal