-
Notifications
You must be signed in to change notification settings - Fork 59
Expand file tree
/
Copy pathclean.bat
More file actions
98 lines (72 loc) · 2.42 KB
/
Copy pathclean.bat
File metadata and controls
98 lines (72 loc) · 2.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
@echo off
setlocal EnableDelayedExpansion
REM Check command line argument to determine cleanup level
if /I "%~1"=="all" goto cleanall
if /I "%~1"=="help" goto usage
if /I "%~1"=="?" goto usage
REM Default: basic clean behavior (like Makefile clean target)
echo Performing basic cleanup...
REM Clean auxiliary files generated by LaTeX using latexmk
if exist "sustechthesis-example.tex" (
latexmk -c sustechthesis-example
)
if exist "sustechthesis-example-report.tex" (
latexmk -c sustechthesis-example-report
)
if exist "sustechthesis.dtx" (
latexmk -c sustechthesis.dtx
)
REM Delete common auxiliary files that might remain
call :delete_files *.aux *.bbl *.blg *.toc *.lof *.lot *.out *.fls *.fdb_latexmk *.synctex.gz *.bcf *.run.xml *.xdv *.idv *.lg *.xwm
REM Delete minted temporary directories
call :delete_dirs _minted-*
REM Delete temporary files with tilde
call :delete_files *~
REM Delete markdown-related temporary files
call :delete_files *_markdown_*.tex *_markdown_* *.markdown.*
goto completed
:cleanall
echo Performing full cleanup (cleanall)...
REM Clean auxiliary files generated by LaTeX using latexmk
if exist "sustechthesis-example.tex" (
latexmk -c sustechthesis-example
)
if exist "sustechthesis-example-report.tex" (
latexmk -c sustechthesis-example-report
)
if exist "sustechthesis.dtx" (
latexmk -c sustechthesis.dtx
)
REM Delete common auxiliary files that might remain
call :delete_files *.aux *.bbl *.blg *.toc *.lof *.lot *.out *.fls *.fdb_latexmk *.synctex.gz *.bcf *.run.xml *.xdv *.idv *.lg *.xwm
REM Delete minted temporary directories
call :delete_dirs _minted-*
REM Delete temporary files with tilde
call :delete_files *~
REM Delete markdown-related temporary files
call :delete_files *_markdown_*.tex *_markdown_* *.markdown.*
REM Additionally delete generated class files and PDFs (cleanall behavior)
call :delete_files sustechthesis.cls dtx-style.sty
call :delete_files sustechthesis.pdf sustechthesis-example.pdf sustechthesis-example-report.pdf
REM Delete test-related directories
call :delete_dirs public-test dist
:completed
echo Cleanup operation completed.
goto end
:delete_files
del /Q %* 2>nul
goto :eof
:delete_dirs
for /d %%d in (%*) do (
if exist "%%d" (
rmdir /s /q "%%d" 2>nul
)
)
goto :eof
:usage
echo Usage:
echo clean.bat - Basic cleanup (default)
echo clean.bat all - Full cleanup (removes generated files too)
echo clean.bat help - Show this help
:end
pause