清理TeX临时文件的一个脚本(Cygwin)
运行`./clean.sh`列出要清理的文件
运行`./clean.sh -d`执行清理
请根据需要修改目录`texdir`
脚本源码
#!/bin/bash
# Name: clean.sh
# Desp: Clean the template file of tex, only reserve tex bib and pdf
# Usage: clean.sh list the file to be cleaned
# clean.sh -d do the clean
# Copyright: Version 1.0 @2017.06.13/By Van Abel
# please change the texdir to your situation
exts_reg=".*\.(aux|bak[0-9]?|bbl|bcf|blg|brf|fdb_latexmk|fls|glg|glo|gls|idx|ilg|ind|ist||lof|log|ltx|mpx|nav|out|pdfsync|snm|swn|swo|swp|synctex.*\.gz|gz\(busy\)|tex\.latexmain|tex~|toc|txt|run\.xml')$"
texdir='/cygdrive/d/CTEX/TEXDOC/'
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
printf "Usage: \n$0\t\t list files to be deleted\n$0 -d\t delete the files"
elif [ -z $1 ]; then
find ${texdir} -regextype posix-egrep -regex ${exts_reg} -type f
else
find ${texdir} -regextype posix-egrep -regex ${exts_reg} -type f -delete
fi
本作品采用创作共用版权协议, 要求署名、非商业用途和保持一致. 转载本站内容必须也遵循署名-非商业用途-保持一致的创作共用协议.

发表回复