From: "Dmitry V. Levin" <ldv@fandra.org>
To: mandrake-russian@linuxteam.iplabs.ru
Subject: [mdk-re] Re: [mdk-re] Удаление битых ссылок
Date: Fri Feb 9 14:16:12 2001
Message-ID: <20010209142052.C30907@LDV.fandra.org> (raw)
In-Reply-To: <OFDFEEFB10.AB0A1AC1-ONC62569EE.0033D311@novosoft.ru>; from denf@novosoft.ru on Fri, Feb 09, 2001 at 03:29:06PM +0600
[-- Attachment #1: Type: text/plain, Size: 1342 bytes --]
On Fri, Feb 09, 2001 at 03:29:06PM +0600, denf@novosoft.ru wrote:
> >Волею судеб, на сервере в одном каталоге и его подкаталогах образуется
> >большое количество битых символических ссылок (то есть указывающих на
> >уже не_существующие файлы). Этих ссылок много и чистить их руками сильно
> >ломает. Может подскажет кто простой способ автоматизации этого дела?
> >Хотелось бы залудить на cron скриптик, который лез бы в вышеозначеный
> >каталог и рекурсивно долбал бы все эти битые ссылки.
>
> что-нибудь типа
> if [ -L $file ] && [ ! -f $file ]; then
> rm -f $file
> fi
Корректнее так:
[ ! -L "$file" -o -e "$file" ] || rm -f "$file"
Если встречаются файлы с пробелами в именах, то эту строчку следует
выделить в отдельный скрипт, и вызывать через "find -print 0 |xargs -r0".
См. тж. find(1), test(1), xargs(1).
> ну и все это в цикле пустить с помощью find
>
> PS. bash rulez ;-)
Regards,
Dmitry
+-------------------------------------------------------------------------+
Dmitry V. Levin mailto://ldv@fandra.org
Software Engineer PGP pubkey http://www.fandra.org/users/ldv/pgpkeys.html
IPLabs Linux Team http://linux.iplabs.ru
Fandra Project http://www.fandra.org
+-------------------------------------------------------------------------+
UNIX is user friendly. It's just very selective about who its friends are.
[-- Attachment #2: Type: application/pgp-signature, Size: 232 bytes --]
next prev parent reply other threads:[~2001-02-09 14:16 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-02-09 12:25 denf
2001-02-09 14:16 ` Dmitry V. Levin [this message]
2001-02-09 15:36 ` [mdk-re] " cornet
2001-02-09 15:58 ` cornet
2001-02-09 16:33 ` cornet
2001-02-10 4:18 ` Dmitry V. Levin
2001-02-12 12:14 ` cornet
2001-02-09 15:29 ` cornet
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20010209142052.C30907@LDV.fandra.org \
--to=ldv@fandra.org \
--cc=mandrake-russian@linuxteam.iplabs.ru \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
ALT Linux Community general discussions
This inbox may be cloned and mirrored by anyone:
git clone --mirror http://lore.altlinux.org/community/0 community/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 community community/ http://lore.altlinux.org/community \
mandrake-russian@linuxteam.iplabs.ru community@lists.altlinux.org community@lists.altlinux.ru community@lists.altlinux.com
public-inbox-index community
Example config snippet for mirrors.
Newsgroup available over NNTP:
nntp://lore.altlinux.org/org.altlinux.lists.community
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git