[nzlug] Any way to edit broken soft links?
Peter Butler
peter.butler at 141.com
Mon Dec 10 17:01:14 NZDT 2007
How about something like this:|
#!/bin/bash
dir='dir_containing_links'
target_dir='dir_containing_targets'
for i in `find $dir -type l`; do
if [ ! -e $i ]; then
new_name=$i.new # Do mangling to new name here
echo $i is broken, changing to $new_name
ln -fs $target_dir/$new_name $i
fi
done
Cheers
Peter
|||
Raimund Eimann wrote:
> Hi,
>
> On Monday 10 December 2007, Simon Green wrote:
>
>> What's wrong with ln -fs <old> <new>?
>>
>
> This simply creates a new link. I'm looking for something to edit the existing
> link, because only a few characters have changed in the filename of the link
> target (that's why the link is broken now). If there would be a way to edit
> the "contents" of a link, I could simply change the characters in there as
> well and the link would work again.
>
> Note: This is not about a single soft link. It's about several hundreds, maybe
> thousands. I don't want to fix them all manually by removing old links and
> creating new ones. I don't really believe that I'm the first person running
> into this problem?
>
> Why all the original filenames have changed? Because umlaut characters were no
> longer displayed properly and I needed to run a convmv to convert all files
> in a large filesystem from a latin1 encoding into utf-8.
>
> Cheers,
> Raimund
>
>
> Today's wisdom:
> Suicidal twin kills sister by mistake!
>
> _______________________________________________
> NZLUG mailing list NZLUG at linux.net.nz
> http://www.linux.net.nz/cgi-bin/mailman/listinfo/nzlug
>
>
>
More information about the NZLUG
mailing list