X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?p=dupemerge;a=blobdiff_plain;f=dm6;h=874534fac260f177fd174250296d0a872fb16aa3;hp=c6f93d906e94025621b230a6baa07e83dda44a5f;hb=79c8d21ca871e2f52d8de960cbf2534ba4509491;hpb=5b34b57b3f1927f907fafbb70913b23fe6d36b12 diff --git a/dm6 b/dm6 index c6f93d9..874534f 100755 --- a/dm6 +++ b/dm6 @@ -186,6 +186,15 @@ while () { warn "$file: $@" if $@; } +# Garbage collection +print STDERR "\nGarbage collection in '$link_dir'..."; +chdir($link_dir) || die "chdir: $link_dir: $!"; +print STDERR "\nRemoving files with link count < 3..."; +system("find digest inode -type f -links -3 -print0 | xargs -0 rm -f") and die "system: exit status $?"; +print STDERR "\nRemoving empty directories..."; +system("find digest inode -type d -empty -print0 | xargs -0r rmdir -p --ignore-fail-on-non-empty") and die "system: exit status $?"; +print STDERR "\nDone.\n"; + exit(0); __END__