Delphi · 2025年6月11日

Delphi开发必备:删除开发目录下的临时文件

转自:批处理 遍历删除delphi源码文件夹下dcu等所有类型的临时文件,包括其子文件夹_delphi 删除文件夹下所有文件-CSDN博客

将下面的代码保存为bat批处理文件,然后拷贝到需要清理临时文件的目录下执行即可

@echo off
setlocal Enable,ayedExpansion

set "searchPath=%cd%"

echo deleting .dcu and ~pas files under %searchPath% ...

for /r "%searchPath%" %%f in ( 
, *.~ddp
, *.~dpr
, *.~pas
, *.~pa
, *.~dfm
, *.$$$
, *.dcu) do (
    del "%%f"
    echo deleted "%%f"
)

echo All .dcu and ~pas files have been deleted.
Pascal