分类
LaTeX

清理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

发表回复

您的电子邮箱地址不会被公开。

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据