home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 3 / 3914 < prev    next >
Encoding:
Internet Message Format  |  1991-08-28  |  18.9 KB

  1. Path: wupost!usc!rutgers!rochester!ferguson
  2. From: ferguson@cs.rochester.edu (George Ferguson)
  3. Newsgroups: alt.sources
  4. Subject: Perl scripts for cleaning directory hierarchies
  5. Message-ID: <1991Aug26.172434.2573@cs.rochester.edu>
  6. Date: 26 Aug 91 17:24:34 GMT
  7. Reply-To: ferguson@cs.rochester.edu (George Ferguson)
  8. Distribution: alt
  9. Organization: University of Rochester Computer Science Dept.
  10. Lines: 620
  11.  
  12. [ Apologies for the cancellation and repost if it got to you. I simply
  13.   added some echo lines to the Makefile. ]
  14.  
  15. The following shar provides three useful scripts for removing those
  16. Emacs backup files and all that LaTeX garbage. The "-n" option causes
  17. them to just print what would be deleted without doing it. There are
  18. also "-l" (long output) and "-t" (print totals). I swear by "-nvt" to
  19. see how much I can get back before cleaning.
  20.  
  21. The script "clean-files" is a Perl script based on "find2perl"'s
  22. conversion of my previous find(1) scripts. The other three scripts
  23. are Bourne shell scripts that invoke clean-files with an appropriate
  24. pattern. Pedantic Perl hackers can no doubt do better -- be my guest.
  25.  
  26. While I use these programs myself, I will not be held responsible for
  27. damage arising from your use of them. THEY DO DELETE FILES. You have
  28. been warned.
  29.  
  30. The README is reproduced below:
  31.  
  32.     README for clean-files and related files
  33.  
  34. George Ferguson, ferguson@cs.rochester.edu, 26 Aug 1991.
  35.  
  36.  
  37. This distribution includes the base program "clean-files" which is a
  38. Perl script for deleting files matching a given Perl expression (or
  39. doing some other things, see the man page). As applications of
  40. clean-files, the scripts "clean-emacs-files", "clean-tex-files", and
  41. "clean-obj-files" are included.  These all just specify the
  42. appropriate expression and invoke clean-files.  In particular,
  43. clean-tex-files illustrates how fairly complicated expressions can be
  44. used.
  45.  
  46. Edit the Makefile to set BINDIR, MANDIR, and any variables as required
  47. for your site. Then "make install" will install the scripts, and
  48. "make install.man" will install the man pages. If your system does not
  49. understand #!, you will have to make a shell script wrapper for
  50. clean-files.
  51.  
  52. #! /bin/sh
  53. # This is a shell archive.  Remove anything before this line, then unpack
  54. # it by saving it into a file and typing "sh file".  To overwrite existing
  55. # files, type "sh file -c".  You can also feed this as standard input via
  56. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  57. # will see the following message at the end:
  58. #        "End of archive 1 (of 1)."
  59. # Contents:  Makefile README clean-emacs-files clean-emacs-files.man
  60. #   clean-files clean-files.man clean-obj-files clean-obj-files.man
  61. #   clean-tex-files clean-tex-files.man
  62. # Wrapped by ferguson@swan.cs.rochester.edu on Mon Aug 26 13:22:39 1991
  63. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  64. if test -f 'Makefile' -a "${1}" != "-c" ; then 
  65.   echo shar: Will not clobber existing file \"'Makefile'\"
  66. else
  67. echo shar: Extracting \"'Makefile'\" \(593 characters\)
  68. sed "s/^X//" >'Makefile' <<'END_OF_FILE'
  69. X#
  70. X# Makefile for clean-files and related files
  71. X#
  72. X# George Ferguson, ferguson@cs.rochester.edu, 23 Aug 1991.
  73. X#
  74. X
  75. XFILES=clean-files clean-emacs-files clean-tex-files clean-obj-files
  76. XBINDIR=/usr/bin
  77. XMANDIR=/usr/man/man1
  78. XMANEXT=1
  79. X
  80. XINSTALL=install
  81. XINSTPGMFLAGS=-c -m 0755
  82. XINSTMANFLAGS=-c -m 0644
  83. X
  84. Xall:
  85. X    @echo 'Everything is up to date'
  86. X
  87. Xinstall:
  88. X    @for f in $(FILES); \
  89. X    do echo "installing $$f"; \
  90. X       $(INSTALL) $(INSTPGMFLAGS) $$f $(BINDIR)/$$f; \
  91. X    done
  92. X
  93. X
  94. Xinstall.man:
  95. X    @for f in $(FILES); \
  96. X    do echo "installing $$f.man"; \
  97. X       $(INSTALL) $(INSTMANFLAGS) $$f.man $(MANDIR)/$$f.$(MANEXT); \
  98. X    done
  99. END_OF_FILE
  100. if test 593 -ne `wc -c <'Makefile'`; then
  101.     echo shar: \"'Makefile'\" unpacked with wrong size!
  102. fi
  103. # end of 'Makefile'
  104. fi
  105. if test -f 'README' -a "${1}" != "-c" ; then 
  106.   echo shar: Will not clobber existing file \"'README'\"
  107. else
  108. echo shar: Extracting \"'README'\" \(856 characters\)
  109. sed "s/^X//" >'README' <<'END_OF_FILE'
  110. X    README for clean-files and related files
  111. X
  112. XGeorge Ferguson, ferguson@cs.rochester.edu, 26 Aug 1991.
  113. X
  114. X
  115. XThis distribution includes the base program "clean-files" which is a
  116. XPerl script for deleting files matching a given Perl expression (or
  117. Xdoing some other things, see the man page). As applications of
  118. Xclean-files, the scripts "clean-emacs-files", "clean-tex-files", and
  119. X"clean-obj-files" are included.  These all just specify the
  120. Xappropriate expression and invoke clean-files.  In particular,
  121. Xclean-tex-files illustrates how fairly complicated expressions can be
  122. Xused.
  123. X
  124. XEdit the Makefile to set BINDIR, MANDIR, and any variables as required
  125. Xfor your site. Then "make install" will install the scripts, and
  126. X"make install.man" will install the man pages. If your system does not
  127. Xunderstand #!, you will have to make a shell script wrapper for
  128. Xclean-files.
  129. X
  130. END_OF_FILE
  131. if test 856 -ne `wc -c <'README'`; then
  132.     echo shar: \"'README'\" unpacked with wrong size!
  133. fi
  134. # end of 'README'
  135. fi
  136. if test -f 'clean-emacs-files' -a "${1}" != "-c" ; then 
  137.   echo shar: Will not clobber existing file \"'clean-emacs-files'\"
  138. else
  139. echo shar: Extracting \"'clean-emacs-files'\" \(290 characters\)
  140. sed "s/^X//" >'clean-emacs-files' <<'END_OF_FILE'
  141. X#!/bin/sh
  142. X#
  143. X# clean-emacs-files: Invoke clean-files with an expression that selects
  144. X#    files that end in "~" or start and end with "#".
  145. X#
  146. X# George Ferguson, ferguson@cs.rochester.edu, 23 Aug 1991.
  147. X#
  148. X
  149. XCLEAN_FILES_CALLER="$0"
  150. Xexport CLEAN_FILES_CALLER
  151. Xexec clean-files '/~$/ || /^#.*#$/' "$@"
  152. END_OF_FILE
  153. if test 290 -ne `wc -c <'clean-emacs-files'`; then
  154.     echo shar: \"'clean-emacs-files'\" unpacked with wrong size!
  155. fi
  156. chmod +x 'clean-emacs-files'
  157. # end of 'clean-emacs-files'
  158. fi
  159. if test -f 'clean-emacs-files.man' -a "${1}" != "-c" ; then 
  160.   echo shar: Will not clobber existing file \"'clean-emacs-files.man'\"
  161. else
  162. echo shar: Extracting \"'clean-emacs-files.man'\" \(1086 characters\)
  163. sed "s/^X//" >'clean-emacs-files.man' <<'END_OF_FILE'
  164. X.TH CLEAN-EMACS-FILES 1 "23 Aug 1991" "U of Rochester"
  165. X.SH NAME
  166. Xclean-emacs-files \- remove files that emacs leaves lying around
  167. X.SH SYNOPSIS
  168. X.I clean\-emacs\-files
  169. X[\fB\-nvlt\fP]
  170. X[\fIdirectory\fP]
  171. X.SH DESCRIPTION
  172. X.PP
  173. X.I Clean\-emacs\-files
  174. Xsearches the directory tree rooted at the given directory and deletes
  175. Xall files whose names end with a tilde ("~") (\fIemacs\fP backup
  176. Xfiles) or that start and end with a hash symbol ("#") (\fIemacs\fP autosave
  177. Xfiles).  If no directory is given, the search is rooted at the current
  178. Xworking directory.
  179. X.SH OPTIONS
  180. X.PP
  181. X.IP \fB-n\fP
  182. XNo execute mode: The files are not removed. Implies \fB-v\fP if
  183. Xneither \fB-t\fP nor \fB-l\fP are given.
  184. X.IP \fB-v\fP
  185. XVerbose mode: Prints names of deleted files to stdout, one per line.
  186. X.IP \fB-l\fP
  187. XLong verbosity mode:
  188. XPrints "ls\ \-lig" information for each deleted file.
  189. X.IP \fB-t\fP
  190. XTotal mode: Prints the number of files and total bytes deleted to
  191. Xstdout when the search is completed.
  192. X.SH SEE ALSO
  193. X.PP
  194. Xemacs(1),
  195. Xclean\-files(1),
  196. Xfind(1),
  197. Xperl(1).
  198. X.SH AUTHOR
  199. X.PP
  200. XGeorge Ferguson (ferguson@cs.rochester.edu).
  201. X
  202. X
  203. END_OF_FILE
  204. if test 1086 -ne `wc -c <'clean-emacs-files.man'`; then
  205.     echo shar: \"'clean-emacs-files.man'\" unpacked with wrong size!
  206. fi
  207. # end of 'clean-emacs-files.man'
  208. fi
  209. if test -f 'clean-files' -a "${1}" != "-c" ; then 
  210.   echo shar: Will not clobber existing file \"'clean-files'\"
  211. else
  212. echo shar: Extracting \"'clean-files'\" \(4255 characters\)
  213. sed "s/^X//" >'clean-files' <<'END_OF_FILE'
  214. X#!/usr/staff/bin/perl
  215. X#
  216. X# clean-files : Removes files in a directory tree.
  217. X#
  218. X# The first argument must be a Perl expression that will identify
  219. X# the relevant files using $_ as the filename. The second argument,
  220. X# if given, is the directory to start the search in. The two arguments
  221. X# can be separated by any of the switches -n, -v, -t, and -l.
  222. X#
  223. X# This program underlies such programs as "clean-emacs-files",
  224. X# "clean-tex-files", and "clean-obj-files". See these for examples
  225. X# of how to specify complex patterns. Note that those programs should
  226. X# set the environment variable CLEAN_FILES_CALLER to get an appropriate
  227. X# usage message.
  228. X#
  229. X# George Ferguson, ferguson@cs.rochester.edu, 23 Aug 1991.
  230. X#
  231. X
  232. X# Load the library code that knows how to walk directory trees
  233. Xrequire "find.pl";
  234. X
  235. X# Set usage message
  236. Xif (($program=$ENV{'CLEAN_FILES_CALLER'}) ne "") {
  237. X    $usage="usage: $program [-ntvl] [directory]\n";
  238. X} else {
  239. X    $program=`basename $0`;
  240. X    chop $program;
  241. X    $usage="usage: $program pattern [-ntvl] [directory]\n";
  242. X}
  243. X
  244. X# The pattern has to be the first argument
  245. Xif ($#ARGV == -1)
  246. X    { die "$usage"; }
  247. Xelse
  248. X    { $pattern=$ARGV[0]; shift; }
  249. X
  250. X# Parse switches
  251. Xwhile ($_ = $ARGV[0], /^-/) {
  252. X    shift;
  253. X    last if /^--$/;
  254. X    if (/n/) { $noexec = 1; }
  255. X    if (/v/) { $verbose = 1; }
  256. X    if (/t/) { $totals = 1; }
  257. X    if (/l/) { $long = 1; }
  258. X    if (/-.*[^ntvl]/) { die "$usage"; }
  259. X}
  260. X# Note that -n implies -v unless -V or -t was given
  261. Xif ($noexec && !$long && !$totals) {
  262. X    $verbose = 1;
  263. X}
  264. X
  265. X# If we need to be very verbose, then set the translation arrays
  266. Xif ($long) {
  267. X    @rwx = ('---','--x','-w-','-wx','r--','r-x','rw-','rwx');
  268. X    @moname = (Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec);
  269. X    while (($name, $pw, $uid) = getpwent) {
  270. X    $user{$uid} = $name unless $user{$uid};
  271. X    }
  272. X    while (($name, $pw, $gid) = getgrent) {
  273. X    $group{$gid} = $name unless $group{$gid};
  274. X    }
  275. X}
  276. X
  277. X# Now do the find, which calls &wanted for each file
  278. Xif ($#ARGV == -1)
  279. X    { &find('.'); }
  280. Xelsif ($#ARGV == 0)
  281. X    { &find($ARGV[0]); }
  282. Xelse
  283. X    { die "$usage"; }
  284. X
  285. X# Print the totals if requested
  286. Xif ($totals) {
  287. X    printf "$program: $numfiles files ($numbytes bytes) %sdeleted\n",
  288. X       ($noexec ? "would be " : "");
  289. X}
  290. X
  291. X# Goodbye
  292. Xexit;
  293. X
  294. X# wanted: Called for each file. Filename is in $_, directory name in
  295. X# $dir (and we are switched to that directory), and full pathname in $name.
  296. Xsub wanted {
  297. X    if (eval($pattern)) {
  298. X    if ($verbose) {
  299. X        print "$name\n";
  300. X    }
  301. X    if ($totals || $long) {
  302. X        ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size) = lstat($_);
  303. X        if ($long) {
  304. X        &ls;
  305. X        }
  306. X        if ($totals) {
  307. X        $numfiles += 1;
  308. X        $numbytes += $size;
  309. X        }
  310. X    }
  311. X    if (!$noexec) {
  312. X        unlink($_);
  313. X    }
  314. X    }
  315. X}
  316. X
  317. X# ls: Generated automatically by find2perl for the -ls option
  318. Xsub ls {
  319. X    ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$sizemm,
  320. X      $atime,$mtime,$ctime,$blksize,$blocks) = lstat(_);
  321. X
  322. X    $pname = $name;
  323. X
  324. X    if (defined $blocks) {
  325. X    $blocks = int(($blocks + 1) / 2);
  326. X    }
  327. X    else {
  328. X    $blocks = int(($size + 1023) / 1024);
  329. X    }
  330. X
  331. X    if    (-f _) { $perms = '-'; }
  332. X    elsif (-d _) { $perms = 'd'; }
  333. X    elsif (-c _) { $perms = 'c'; $sizemm = &sizemm; }
  334. X    elsif (-b _) { $perms = 'b'; $sizemm = &sizemm; }
  335. X    elsif (-p _) { $perms = 'p'; }
  336. X    elsif (-S _) { $perms = 's'; }
  337. X    else         { $perms = 'l'; $pname .= ' -> ' . readlink($_); }
  338. X
  339. X    $tmpmode = $mode;
  340. X    $tmp = $rwx[$tmpmode & 7];
  341. X    $tmpmode >>= 3;
  342. X    $tmp = $rwx[$tmpmode & 7] . $tmp;
  343. X    $tmpmode >>= 3;
  344. X    $tmp = $rwx[$tmpmode & 7] . $tmp;
  345. X    substr($tmp,2,1) =~ tr/-x/Ss/ if -u _;
  346. X    substr($tmp,5,1) =~ tr/-x/Ss/ if -g _;
  347. X    substr($tmp,8,1) =~ tr/-x/Tt/ if -k _;
  348. X    $perms .= $tmp;
  349. X
  350. X    $user = $user{$uid} || $uid;
  351. X    $group = $group{$gid} || $gid;
  352. X
  353. X    ($sec,$min,$hour,$mday,$mon,$year) = localtime($mtime);
  354. X    $moname = $moname[$mon];
  355. X    if (-M _ > 365.25 / 2) {
  356. X    $timeyear = '19' . $year;
  357. X    }
  358. X    else {
  359. X    $timeyear = sprintf("%02d:%02d", $hour, $min);
  360. X    }
  361. X
  362. X    printf "%5lu %4ld %-10s %2d %-8s %-8s %8s %s %2d %5s %s\n",
  363. X        $ino,
  364. X         $blocks,
  365. X              $perms,
  366. X                $nlink,
  367. X                $user,
  368. X                     $group,
  369. X                      $sizemm,
  370. X                          $moname,
  371. X                         $mday,
  372. X                             $timeyear,
  373. X                             $pname;
  374. X    1;
  375. X}
  376. X
  377. Xsub sizemm {
  378. X    sprintf("%3d, %3d", ($rdev >> 8) & 255, $rdev & 255);
  379. X}
  380. X
  381. END_OF_FILE
  382. if test 4255 -ne `wc -c <'clean-files'`; then
  383.     echo shar: \"'clean-files'\" unpacked with wrong size!
  384. fi
  385. chmod +x 'clean-files'
  386. # end of 'clean-files'
  387. fi
  388. if test -f 'clean-files.man' -a "${1}" != "-c" ; then 
  389.   echo shar: Will not clobber existing file \"'clean-files.man'\"
  390. else
  391. echo shar: Extracting \"'clean-files.man'\" \(1731 characters\)
  392. sed "s/^X//" >'clean-files.man' <<'END_OF_FILE'
  393. X.TH CLEAN-FILES 1 "23 Aug 1991" "U of Rochester"
  394. X.SH NAME
  395. Xclean-files \- remove files matching a pattern
  396. X.SH SYNOPSIS
  397. X.I clean\-files
  398. X\fIperl-expr\fP
  399. X[\fB\-nvlt\fP]
  400. X[\fIdirectory\fP]
  401. X.SH DESCRIPTION
  402. X.PP
  403. X.I Clean\-files
  404. Xsearches the directory tree rooted at the given directory and deletes
  405. Xall files whose names are recognized by the given
  406. X.IR perl-expr .
  407. XThis expression (see
  408. X.IR perl (1))
  409. Xshould test $_ and return true (non-zero) if the file named by it in
  410. Xthe current directory should be deleted. Note that
  411. X.IR perl 's
  412. Xdirectory searching routines put you in the file's directory before
  413. Xtesting the expression.
  414. XIf no directory is given, the search is rooted at the current
  415. Xworking directory.
  416. X.PP
  417. X.I Clean\-files
  418. Xis really meant to be used by other tools that specify appropriate
  419. Xpatterns for common removal chores. In this regard, see
  420. X.IR clean\-emacs\-files (1),
  421. X.IR clean\-tex-files (1),
  422. Xand
  423. X.IR clean\-obj\-files (1).
  424. X.I Clean\-files
  425. Xis significantly faster than equivalent
  426. X.IR find (1)
  427. Xcommands, primarily due to its builtin
  428. X.I unlink()
  429. Xfunction.
  430. X.SH OPTIONS
  431. X.PP
  432. X.IP \fB-n\fP
  433. XNo execute mode: The files are not removed. Implies \fB-v\fP if
  434. Xneither \fB-t\fP nor \fB-l\fP are given.
  435. X.IP \fB-v\fP
  436. XVerbose mode: Prints names of deleted files to stdout, one per line.
  437. X.IP \fB-l\fP
  438. XLong verbosity mode:
  439. XPrints "ls\ \-lig" information for each deleted file.
  440. X.IP \fB-t\fP
  441. XTotal mode: Prints the number of files and total bytes deleted to
  442. Xstdout when the search is completed.
  443. X.SH ENVIRONMENT
  444. X.IP CLEAN_FILES_CALLER
  445. XName of invoking program for usage message, if any.
  446. X.SH "SEE ALSO"
  447. X.PP
  448. Xclean\-emacs\-files(1),
  449. Xclean\-tex-files(1),
  450. Xclean\-obj\-files(1),
  451. Xfind(1),
  452. Xperl(1).
  453. X.SH AUTHOR
  454. X.PP
  455. XGeorge Ferguson (ferguson@cs.rochester.edu).
  456. X
  457. X
  458. END_OF_FILE
  459. if test 1731 -ne `wc -c <'clean-files.man'`; then
  460.     echo shar: \"'clean-files.man'\" unpacked with wrong size!
  461. fi
  462. # end of 'clean-files.man'
  463. fi
  464. if test -f 'clean-obj-files' -a "${1}" != "-c" ; then 
  465.   echo shar: Will not clobber existing file \"'clean-obj-files'\"
  466. else
  467. echo shar: Extracting \"'clean-obj-files'\" \(254 characters\)
  468. sed "s/^X//" >'clean-obj-files' <<'END_OF_FILE'
  469. X#!/bin/sh
  470. X#
  471. X# clean-objs-files: Invoke clean-files with an expression that selects
  472. X#    files that end in ".o".
  473. X#
  474. X# George Ferguson, ferguson@cs.rochester.edu, 23 Aug 1991.
  475. X#
  476. X
  477. XCLEAN_FILES_CALLER="$0"
  478. Xexport CLEAN_FILES_CALLER
  479. Xexec clean-files '/\.o$/' "$@"
  480. END_OF_FILE
  481. if test 254 -ne `wc -c <'clean-obj-files'`; then
  482.     echo shar: \"'clean-obj-files'\" unpacked with wrong size!
  483. fi
  484. chmod +x 'clean-obj-files'
  485. # end of 'clean-obj-files'
  486. fi
  487. if test -f 'clean-obj-files.man' -a "${1}" != "-c" ; then 
  488.   echo shar: Will not clobber existing file \"'clean-obj-files.man'\"
  489. else
  490. echo shar: Extracting \"'clean-obj-files.man'\" \(937 characters\)
  491. sed "s/^X//" >'clean-obj-files.man' <<'END_OF_FILE'
  492. X.TH CLEAN-OBJ-FILES 1 "23 Aug 1991" "U of Rochester"
  493. X.SH NAME
  494. Xclean-obj-files \- remove object files
  495. X.SH SYNOPSIS
  496. X.I clean\-obj\-files
  497. X[\fB\-nvlt\fP]
  498. X[\fIdirectory\fP]
  499. X.SH DESCRIPTION
  500. X.PP
  501. X.I Clean\-obj\-files
  502. Xsearches the directory tree rooted at the given directory and deletes
  503. Xall files whose names end in ".o".  If no directory is given, the
  504. Xsearch is rooted at the current working directory.
  505. X.SH OPTIONS
  506. X.PP
  507. X.IP \fB-n\fP
  508. XNo execute mode: The files are not removed. Implies \fB-v\fP if
  509. Xneither \fB-t\fP nor \fB-l\fP are given.
  510. X.IP \fB-v\fP
  511. XVerbose mode: Prints names of deleted files to stdout, one per line.
  512. X.IP \fB-l\fP
  513. XLong verbosity mode:
  514. XPrints "ls\ \-lig" information for each deleted file.
  515. X.IP \fB-t\fP
  516. XTotal mode: Prints the number of files and total bytes deleted to
  517. Xstdout when the search is completed.
  518. X.SH SEE ALSO
  519. X.PP
  520. Xcc(1),
  521. Xclean\-files(1),
  522. Xfind(1),
  523. Xperl(1).
  524. X.SH AUTHOR
  525. X.PP
  526. XGeorge Ferguson (ferguson@cs.rochester.edu).
  527. X
  528. X
  529. END_OF_FILE
  530. if test 937 -ne `wc -c <'clean-obj-files.man'`; then
  531.     echo shar: \"'clean-obj-files.man'\" unpacked with wrong size!
  532. fi
  533. # end of 'clean-obj-files.man'
  534. fi
  535. if test -f 'clean-tex-files' -a "${1}" != "-c" ; then 
  536.   echo shar: Will not clobber existing file \"'clean-tex-files'\"
  537. else
  538. echo shar: Extracting \"'clean-tex-files'\" \(429 characters\)
  539. sed "s/^X//" >'clean-tex-files' <<'END_OF_FILE'
  540. X#!/bin/sh
  541. X#
  542. X# clean-tex-files: Invoke clean-files with an expression that selects
  543. X#    files that end in ".aux" or ".dvi", or those that end in ".log"
  544. X#    for which there's a ".tex" file in the same directory.
  545. X#
  546. X# George Ferguson, ferguson@cs.rochester.edu, 23 Aug 1991.
  547. X#
  548. X
  549. XCLEAN_FILES_CALLER="$0"
  550. Xexport CLEAN_FILES_CALLER
  551. Xexec clean-files '/\.aux$/ || /\.dvi$/ ||
  552. X    (/\.log$/ && ($tex=$_) && ($tex=~s/\.log$/.tex/) && -e $tex)' "$@"
  553. END_OF_FILE
  554. if test 429 -ne `wc -c <'clean-tex-files'`; then
  555.     echo shar: \"'clean-tex-files'\" unpacked with wrong size!
  556. fi
  557. chmod +x 'clean-tex-files'
  558. # end of 'clean-tex-files'
  559. fi
  560. if test -f 'clean-tex-files.man' -a "${1}" != "-c" ; then 
  561.   echo shar: Will not clobber existing file \"'clean-tex-files.man'\"
  562. else
  563. echo shar: Extracting \"'clean-tex-files.man'\" \(1105 characters\)
  564. sed "s/^X//" >'clean-tex-files.man' <<'END_OF_FILE'
  565. X.TH CLEAN-TEX-FILES 1 "23 Aug 1991" "U of Rochester"
  566. X.SH NAME
  567. Xclean-tex-files \- remove files that TeX and LaTeX leave lying around
  568. X.SH SYNOPSIS
  569. X.I clean\-tex\-files
  570. X[\fB\-nvlt\fP]
  571. X[\fIdirectory\fP]
  572. X.SH DESCRIPTION
  573. X.PP
  574. X.I Clean\-tex\-files
  575. Xsearches the directory tree rooted at the given directory and deletes
  576. Xall files whose names end with ".aux", ".dvi", or ".log". Files ending
  577. Xin ".log" are only deleted if there is a corresponding ".tex" file in
  578. Xthe same directory.  If no directory is given, the search is rooted at
  579. Xthe current working directory.
  580. X.SH OPTIONS
  581. X.PP
  582. X.IP \fB-n\fP
  583. XNo execute mode: The files are not removed. Implies \fB-v\fP if
  584. Xneither \fB-t\fP nor \fB-l\fP are given.
  585. X.IP \fB-v\fP
  586. XVerbose mode: Prints names of deleted files to stdout, one per line.
  587. X.IP \fB-l\fP
  588. XLong verbosity mode:
  589. XPrints "ls\ \-lig" information for each deleted file.
  590. X.IP \fB-t\fP
  591. XTotal mode: Prints the number of files and total bytes deleted to
  592. Xstdout when the search is completed.
  593. X.SH SEE ALSO
  594. X.PP
  595. Xtex(1),
  596. Xlatex(1),
  597. Xclean\-files(1),
  598. Xfind(1),
  599. Xperl(1).
  600. X.SH AUTHOR
  601. X.PP
  602. XGeorge Ferguson (ferguson@cs.rochester.edu).
  603. X
  604. X
  605. END_OF_FILE
  606. if test 1105 -ne `wc -c <'clean-tex-files.man'`; then
  607.     echo shar: \"'clean-tex-files.man'\" unpacked with wrong size!
  608. fi
  609. # end of 'clean-tex-files.man'
  610. fi
  611. echo shar: End of archive 1 \(of 1\).
  612. cp /dev/null ark1isdone
  613. MISSING=""
  614. for I in 1 ; do
  615.     if test ! -f ark${I}isdone ; then
  616.     MISSING="${MISSING} ${I}"
  617.     fi
  618. done
  619. if test "${MISSING}" = "" ; then
  620.     echo You have the archive.
  621.     rm -f ark[1-9]isdone
  622. else
  623.     echo You still need to unpack the following archives:
  624.     echo "        " ${MISSING}
  625. fi
  626. ##  End of shell archive.
  627. exit 0
  628. -- 
  629. George Ferguson            ARPA: ferguson@cs.rochester.edu
  630. University of Rochester        UUCP: {decvax,rutgers}!rochester!ferguson
  631. Rochester  NY  14627-0226    VOX:  (716) 275-2527
  632.