-
Notifications
You must be signed in to change notification settings - Fork 9
/
clean.ps1
74 lines (69 loc) · 1.51 KB
/
clean.ps1
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
# ------------------------------------------------------------------------------
# Script: Clean-Temporary-Files.ps1
# Author: Jonas Gröger <[email protected]>
# Date: 12.04.2014
# Keywords: LaTeX, Clean, Delete, Remove, Temporary, Files
# Comments: Removes temporary files created by LaTeX etc. You can tweak it by
# adding extensions or specific files.
# ------------------------------------------------------------------------------
Param(
[String] $Folder = $PSScriptRoot # By default, remove from current directory
)
$files_to_delete = @(
"*-blx.bib",
"*.aux",
"*.bbl",
"*.bcf",
"*.blg",
"*.brf",
"*.idx",
"*.ilg",
"*.ind",
"*.lof",
"*.log",
"*.lol",
"*.lot",
"*.lpr",
"*.nlo",
"*.nls",
"*.out",
"*.pyg",
"*.run.xml",
"*.synctex",
"*.synctex.gz"
"*.tdo",
"*.toc",
"*.bbl.bak",
"*.lof.bak",
"*.fls",
"*.fdb_latexmk",
"*.ist",
"*.glo",
"*.mw",
"*.acn",
"*.syg",
"*.acr",
"*.alg",
"*.slg",
"*.syi",
"*.acr",
"*.alg",
"*.slg",
"*.syi",
"*.txss",
"*.bak",
"*.log",
"*.sav.tmp",
"*.uhy"
)
$n_files_removed = 0
Get-ChildItem $Folder -Recurse -Include $files_to_delete | foreach ($_) {
Write-Host "Removing $($_ | Resolve-Path -Relative)"
Remove-Item $_.FullName
$n_files_removed++
}
if($n_files_removed -eq 0) {
Write-Host "No files removed from: $Folder"
} else {
Write-Host "$n_files_removed files removed from: $Folder"
}