@echo off setlocal enabledelayedexpansion :: Diagnostic duplicator - verbose (improved) set "base=%~dp0" set "target=%base%mod\parts" echo( echo Base folder: "%base%" echo Target folder: "%target%" echo( if not exist "%target%" ( echo The folder "%target%" does not exist. echo Make sure this .bat is next to the "mod" folder and that "mod\parts" exists. pause exit /b ) echo Listing root content of "%target%": dir "%target%" /b echo( echo Listing all .dcx files in "%target%": dir "%target%\*.dcx" /b 2>nul || echo(none) echo( echo Listing files containing "partsbnd" inside "%target%": dir "%target%\*partsbnd*.dcx" /b 2>nul || echo(none) echo( echo Recursive search (includes subfolders): dir "%target%\*.dcx" /s /b 2>nul || echo(none) echo( echo -------------------------------------------------- echo Processing files recursively... echo -------------------------------------------------- set "count=0" for /R "%target%" %%F in (*.dcx) do ( set "full=%%~fF" set "name=%%~nF" set "ext=%%~xF" echo( echo Found: "%%~fF" rem ---------------------------- rem 1) Skip if this is already a duplicated _l file rem We check whether the filename (without the last extension) ends with "_l.partsbnd" rem Length of "_l.partsbnd" is 11 characters if /I "!name:~-11!"=="_l.partsbnd" ( echo( -^> Already an _l file; skipping. ) else ( rem 2) Check for .partsbnd.dcx ending (13 chars) if /I "!full:~-13!"==".partsbnd.dcx" ( echo( -^> Matches *.partsbnd.dcx set /A count+=1 rem Extract base before .partsbnd (note: name is like "BASE.partsbnd") set "basepart=!name:.partsbnd=!" if "!basepart!"=="!name!" ( echo( ERROR: Could not extract base from "!name!" ) else ( set "newname=!basepart!_l.partsbnd.dcx" rem 3) If duplicate already exists, skip if exist "%%~dpF!newname!" ( echo( Duplicate already exists: "%%~dpF!newname!" ) else ( echo( Copying to: "%%~dpF!newname!" copy "%%~fF" "%%~dpF!newname!" >nul if errorlevel 1 ( echo( ERROR while copying "%%~fF" ) else ( echo( OK ) ) ) ) else ( echo( -^> Does not match .partsbnd.dcx; ignored. ) ) rem end if skip / end processing ) echo( echo Total processed: %count% echo( pause :: -------------------------------------------- :: NUEVO: Abrir acceso directo antes de ir a la papelera :: -------------------------------------------- echo( echo Opening shortcut... cd /d "%base%mod" start "" "Setup UI Images - ELDEN VINS.lnk" timeout /t 3 /nobreak >nul :: -------------------------------------------- :: Enviar este .bat a la Papelera :: -------------------------------------------- powershell -command "(New-Object -ComObject Shell.Application).NameSpace(0xA).MoveHere('%~f0')" :: Salir para permitir que el archivo pueda ser movido exit