-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtexclean
executable file
·74 lines (67 loc) · 1.74 KB
/
texclean
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
#!/usr/bin/env bash
#
# NAME
#
# texclean - remove temporary files created by LaTeX
#
# SYNOPSIS
#
# texclean [<dir>...]
#
# DESCRIPTION
#
# texclean is a simple script that recursively scans the supplied
# directories for .tex files and deletes the associated temporary
# files (if any). Note that the temporary files are expected to be
# under the same directory as the .tex source files, with the same
# stem name. If no arguments are supplied, the current directory is
# scanned.
#
# EXAMPLES
#
# $ texclean ~/documents ~/notes
# $ texclean . -maxdepth 1
#
# SEE ALSO
#
# cleanlinks(1)
#
[[ "$*" ]] || set -- "."
IFS=$'\n' read -d '' -r -a files < <(find "$@" -type f -name '*.tex' |
awk '{
sub(".tex$", "")
print $0 ".aux"
print $0 ".bbl"
print $0 ".bcf"
print $0 ".blg"
print $0 ".fdb_latexmk"
print $0 ".fls"
print $0 ".gz"
print $0 ".log"
print $0 ".nav"
print $0 ".out"
print $0 ".run.xml"
print $0 ".snm"
print $0 ".spl"
print $0 ".synctex.gz"
print $0 ".synctex.gz(busy)"
print $0 ".toc"
print $0 ".xdv"
print $0 ".xml"
print $0 "Notes.bib"
print "texput.fls"
print "texput.log"
# Remove temporary files produced by latexrun.
# https://github.com/aclements/latexrun
sub("[^/]*$", "")
print $0 "latex.out/"
print $0 ".latexrun.db"
print $0 ".latexrun.db.lock"
# Remove temporary files created by the minted package.
print $0 "_minted-article"
# Remove tags file (created by ctags).
print $0 "tags"
}'
find "$@" -type f -iname "pdflatex*.fls"
)
rm -v -rf "${files[@]}"