[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: tool to turn redundant files into symlinks



On Monday 21 May 2007 23:51:24 Klaus Ethgen wrote:
> Hi Weskey,
>
> Am Di den 22. Mai 2007 um  0:53 schrieb Wesley J. Landaker:
> > > If hardlinks are okay too, see the "perforate" package (I find this
> > > package hard to find, since the name is somewhat misleading). It's
> > > written in Perl.
> >
> > Well, thanks, I didn't know about this one. But, it does really *have*
> > to be symlinks. I've found a few other tools that do hardlinks. =)
>
> I am the author of perforate. Well I rewritten it from scratch as the
> original tool had some flaws.
>
> It is very easy to add a option for symlinking. But there is a little
> problem deciding which of the files should be the symlink and which the
> original. With hardlinks this is not the problem as after hardlinking
> the files together there is no different between them.

In my case, it could be arbitrary and it would be fine. But it might be a 
good idea to always sort by directory hierarchy (i.e. always either prefer 
to symlink either up or down a directory tree).

> > Anyway, if there isn't something that already does it, I can probably
> > just parse the output of one of these programs and do the symlink
> > replacement myself.
>
> That would be the other way. finddup can print out the double files.

One issue I have with both finddup and fdupes, is they both don't quote 
their output very sanely; or at least, in not in a particularly easy manner 
for parsing (I can do it with a lookbehind regex).

For example:
$ finddup .
2 './file with spaces' './file1' './file with (parens)' './file with a
newline' './file2' './file with 'ticks'' './file with "quotes"'
$ fdupes -1 .
./file1 ./file\ with\ a
newline ./file\ with\ "quotes" ./file\ with\ 'ticks' ./file\ with\ 
(parens) ./file\ with\ spaces ./file2

I would LOVE it if it would shell quote the output or something... or if 
there was a -0 option to delimit things with nulls... or something that 
could make it work reliably with any filename....

Anyway, sounds like maybe I should file some wishlist bugs. =)

-- 
Wesley J. Landaker <wjl@icecavern.net> <xmpp:wjl@icecavern.net>
OpenPGP FP: 4135 2A3B 4726 ACC5 9094  0097 F0A9 8A4C 4CD6 E3D2

Attachment: signature.asc
Description: This is a digitally signed message part.


Reply to: