Can U pipe filenames to rm???
Harald.Eikrem at elab-runit.sintef.no
Harald.Eikrem at elab-runit.sintef.no
Mon Oct 1 12:27:38 AEST 1990
Now, long before xargs I used this little simple utility: --Harald E
/* rmf.c - Removes files according to contents of file arg or stdin */
#include <stdio.h>
int errno;
main(ac,av) char **av;
{
char filen[BUFSIZ];
if (ac > 1 && freopen(av[1], "r", stdin) == NULL) {
perror(av[1]);
fprintf(stderr, "usage: %s [ list-file ]\n\
Removes files according to contents of list-file (or standard input)\n\
one file per input line.\n", av[0]);
exit(1);
}
while (gets(filen))
if (unlink(filen) != 0) perror(filen);
}
More information about the Comp.unix.shell
mailing list