#3369 [file copy] fails to recursively copy directory if it exists

obsolete: 8.4.12
open-rejected
Don Porter
5
2008-07-01
2006-02-15
Matthias Kraft
No

Hi *,

copying directories recursively fails in certain
circumstances.

Easiest way to reproduce:

Have a directory foo/ and do not have a file/directory
bar (otherwise it would just be a step less).

% file copy -- foo bar

-> Now we have a directory bar/

% file copy -- foo bar

-> Fine too, we now have a directory bar/foo/

% file copy -- foo bar

error copying "foo" to "bar/foo": file already exists

-> Which is true, but nonsense as we talk about
directories in both cases. It should just detect that
directory exists already and continue with copying the
stuff below foo/. See POSIX behavior of "cp -R" for
reference.

Tested on SuSE Linux 10.0.

kind regards -- Matthias Kraft

Discussion

  • Vince Darley
    Vince Darley
    2006-02-15

    • status: open --> closed
     
  • Vince Darley
    Vince Darley
    2006-02-15

    • status: closed --> closed-rejected
     
  • Vince Darley
    Vince Darley
    2006-02-15

    Logged In: YES
    user_id=32170

    This is how Tcl's 'file copy' command is documented to behave. If you'd prefer
    some other behaviour, you can easily enough code up a procedure to do your
    own kind of copying.

    You might be interested in what 'file copy -force' does; perhaps closer to your
    liking?

    Vince.

     
  • Matthias Kraft
    Matthias Kraft
    2006-02-15

    Logged In: YES
    user_id=330806

    Hi Vincent,

    sorry for reopening, but I may have been a little bit too
    short in my initial post.

    You are right -force is documented to override here, but it
    doesn't. It doesn't matter whether or not -force is specified.

    Furthermore - but this might be a lack of my english skills
    - the documentation make a distinction between how
    directories and files are handled. So I read there that for
    directories -force isn't needed to get the content
    recursively copied...

    OTOH it could also be that I don't really get a grip on the
    idea of "overwriting a directory"...

    kind regards -- Matthias Kraft

     
  • Matthias Kraft
    Matthias Kraft
    2006-02-15

    • status: closed-rejected --> open-rejected
     
  • Matthias Kraft
    Matthias Kraft
    2008-07-01

    Logged In: YES
    user_id=330806
    Originator: YES

    I still find the behavior surprising, but of course found my way around it.
    So does it still - if ever - qualify as a bug? If not just close it.

    Thanks
    -- Matthias Kraft

     
  • Matthias Kraft
    Matthias Kraft
    2008-07-01

    • assigned_to: vincentdarley --> dgp