[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: rm and ln enhancements -- or a new command -- dog.
From: |
Jim Meyering |
Subject: |
Re: rm and ln enhancements -- or a new command -- dog. |
Date: |
Sat, 27 Oct 2001 09:45:16 +0200 |
User-agent: |
Gnus/5.090004 (Oort Gnus v0.04) Emacs/21.0.107 |
It looks like you want to use GNU find to
remove all symlinks in a directory, No?
Try this
find . -type l -print0 |xargs -0 rm -rf
the -print0 and -0 arguments make it so names including
quotes, spaces, NLs, etc. don't cause trouble.
David Kenneth Michael Weeks <address@hidden> wrote:
> To whom it may concern,
>
> I'd like suggest an enhancement to the current commands of fileutils, or the
> addition of a new command (cat needs dog) that accomplishes the following:
>
> I have precisely 1782 (ls -l | grep '^l' | wc -l , I moved the linked
> directory) dead link files in a directory with precisely 1072 (ls -l | grep
> '^-' | wc -l) original files, and I need to kill the dead links.
>
> I've written a script that gets me close to this objective:
>
> #! /bin/bash
>
> # lsln -- list file name only of all files that are links.
> # This script lists only files that are links, in either a specified
> # directory, or your current directory.
> # Copyright 2001, David Weeks, TampaPC.com, Tampa, Florida, USA.
>
> if [ -d "$1" ]; then
> ls -l $1 | grep '^l' | cut -c 57-200 |
> awk -F " -> " '{ print $1 }'
> else
> ls -l | grep '^l' | cut -c 57-200 |
> awk -F " -> " '{ print $1 }'