mirror of
https://github.com/SinTan1729/random.git
synced 2024-12-26 21:18:36 -06:00
Added deletion support in latex-cleanup
This commit is contained in:
parent
8abb9894b8
commit
7fe112a0b1
1 changed files with 12 additions and 4 deletions
|
@ -1,18 +1,26 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
# I use it to clean up latex build files from a directory after I'm done with the project.
|
# I use it to clean up latex build files from a directory after I'm done with the project.
|
||||||
|
# Just run it inside the directory with the files.
|
||||||
# Depends on trash-cli
|
# Depends on trash-cli
|
||||||
|
# Pass "-delete" to delete files instead of trashing.
|
||||||
|
|
||||||
|
if [ "$1" = "-delete" ]; then
|
||||||
|
echo "Warning: Deleting instead of trashing."
|
||||||
|
d=1
|
||||||
|
else
|
||||||
|
d=0
|
||||||
|
fi
|
||||||
|
|
||||||
for f in *.tex; do
|
for f in *.tex; do
|
||||||
if [ -f "$f" ]; then
|
if [ -f "$f" ]; then
|
||||||
h=$(basename "$f" .tex)
|
h=$(basename "$f" .tex)
|
||||||
echo "Trashing files accompanying $h.tex..."
|
echo "Removing files accompanying $h.tex..."
|
||||||
for g in "$h".*; do
|
for g in "$h".*; do
|
||||||
k=$( echo $g | sed 's/^.*\.//')
|
k=$( echo $g | sed 's/^.*\.//')
|
||||||
if [ "$k" != "tex" ] && [ "$k" != "pdf" ] && [ "$k" != "bib" ] ; then
|
if [ "$k" != "tex" ] && [ "$k" != "pdf" ] && [ "$k" != "bib" ] ; then
|
||||||
echo "Trashing $g..."
|
echo "Removing $g..."
|
||||||
trash "$g"
|
[ $d -eq 0 ] && trash "$g" || rm "$g"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue