On Fri, Sep 11, 2009 at 16:15, Jim Meyering <j...@meyering.net> wrote: > Bert Wesarg wrote: >> On Mon, Sep 7, 2009 at 18:25, Bert Wesarg <bert.wes...@googlemail.com> wrote: >>> Hi all, >>> >>> I'm failing in creating a symlink where the destination is a directory >>> and do a backup of this directory. This is what I tried: >>> >>> $ mkdir a >>> $ ln -s --no-target-directory --backup=numbered b a >>> ln: `a': cannot overwrite directory >>> >>> Looking at the code I can seen the reason, the backup rename() is >>> never executed, because the check whether the target is a directory >>> comes first. >>> >>> Any hints whether this is a bug of ln or how I can create the link >>> while preserving the destination as an backup are more than welcomed. >>> >>> Thanks. >>> Bert >>> >> Thanks to all for the release. But can someone please have a look at my >> problem? > > cp and mv work the same way: even with --backup, they refuse to move > aside a destination directory. > > However, that's something that I've considered worth changing > for years. I never got around to it. If only for the testing > requirements, it will not be a trivial change, since for UI > consistency, it should affect all three at the same time. > > Maybe someone will volunteer to do the work. Maybe a simpler solution would be a new dedicated tool which just backups files, i.e. utilize the find_backup_file_name()/rename() combination and call it 'mkbck'.
Regards Bert