The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 2,731 other followers

Blast from the past: Deleting empty Delphi .ddp files

Posted by jpluimers on 2014/12/09

In Delphi 6 and 7, .ddp files were used to store the Delphi Diagram Portfolios.
Often these files were created empty like `Empty.ddp`, so it pays to clean up those.

The below batch file (part of the free code repository) will help with that. Make sure you download this Empty.ddp file and put it in the same directory as the batch file.

Call the batch file with the path to the directory tree you want to delete the Empty .ddp files from.

@echo off
if #%1#==## goto :help
call :main %*
goto :eof
echo Syntax: %0 Project-Root-Path [Empty.ddp]
echo This will delete all empty DDP files, with the default second paramameter being "%~dp0Empty.ddp"
goto :eof
set emptyDDP=%2
if #%2#==## set emptyDDP=%~dp0Empty.ddp
echo emptyDDP=%emptyDDP%
set root=%1
::echo root=%root%
::Does string have a trailing slash? if so remove it
if %root:~-1%==\ SET root=%root:~0,-1%
::echo root=%root%
for /R %root% %%f in (*.ddp) do call :compare "%%f"
goto :eof
::echo %1
:: do not compare the predefined empty one itself, otherwise it gets deleted
if /I %1=="%emptyDDP%" goto :eof
::echo before %ERRORLEVEL%
FC %1 "%emptyDDP%" > nul
::echo after %ERRORLEVEL%
if ERRORLEVEL 1 goto :keep
if ERRORLEVEL 0 goto :delete
echo ### Wrong ERRORLEVEL
goto :eof
echo keep %1
goto :eof
del %1
goto :eof


One Response to “Blast from the past: Deleting empty Delphi .ddp files”

  1. […] Blast from the past: Deleting empty Delphi .ddp files […]

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: