Copy situation

English support forum

Moderators: white, Hacker, petermad, Stefan2

Post Reply
User avatar
Black Dog
Power Member
Power Member
Posts: 1024
Joined: 2003-02-05, 22:17 UTC
Location: Odessa
Contact:

Copy situation

Post by *Black Dog »

[face=courier]Directory "Apple" with subdirectory "Orange" opened in one panel, in another panel file "Orange" exists. I copy file "Orange" to "Apple" using explorer ("Ctrl"+"C"/"V"). Dialog appears asking me would I like to replace directory "Orange" with file "Orange" and if I answer "Yes" rather predictable "Error Copying File" occurs. And if I try to do it using TC internal copy routine, Commander copy file "Orange" to "Apple" directory w/o any overwrite messages - at least strange 8). But there is the file, actually? Definitely not in "Orange". It is in the "Apple\Orange".
Well, I didn't ask Commander to copy that file anywhere but to "Apple", so I suppose this situation rather strange. And actually I have to admit explorer behavior in this situation is at least predictable... %\[/face]
User avatar
fabiochelly
Power Member
Power Member
Posts: 603
Joined: 2003-02-05, 12:03 UTC
Location: Rambouillet, France

Post by *fabiochelly »

In fact, the problems comes from that for copy and move, TC accepts 2 kinds of destination paths:
1. a standard directory path
2. a directory followed by file(s) pattern(s)

In your case, when you ask to copy your file, TC interpret it as a copy to "c:\apple\orange" and it can't guess if this destination is supposed to be a folder or a file pattern.
By default, if the folder orange exists, TC interprets the destination as "c:\apple\orange\*.*" where to copy your file "orange"

I don't know if it is possible to prevent this problem without changing the way TC interprets copy commands.
Fabio Chelly.
#60241
Lorsqu'on s'occupe d'informatique il faut faire comme les canards...
Paraître calme en surface et pédaler comme un forcené par en dessous
User avatar
Black Dog
Power Member
Power Member
Posts: 1024
Joined: 2003-02-05, 22:17 UTC
Location: Odessa
Contact:

Post by *Black Dog »

[face=courier]On 27-07-2003 00:47:45 +0000 fabiochelly wrote:

FC> and it can't guess if this destination is supposed to be a
FC> folder or a file pattern.


Exactly. But in such a situation I want to be asked, actually %).

FC> By default, if the folder orange exists, TC interprets the
FC> destination as "c:\apple\orange\*.*" where to copy your
FC> file "orange"


Yes, and I can't say this interpretation is correct, IMHO.[/face]
User avatar
WatchUer
Senior Member
Senior Member
Posts: 243
Joined: 2003-02-22, 10:46 UTC
Location: China

Post by *WatchUer »

I think it is a bug, the file named "Orange" without File Extension should be copied to the folder Apple, but it doesn't.
User avatar
Hacker
Moderator
Moderator
Posts: 13068
Joined: 2003-02-06, 14:56 UTC
Location: Bratislava, Slovakia

Post by *Hacker »

I think it is a bug, the file named "Orange" without File Extension should be copied to the folder Apple, but it doesn't.
AFAIK there can't be two files with the same name (a directory is a file, too) in one dir.

HTH
Roman
Mal angenommen, du drückst Strg+F, wählst die FTP-Verbindung (mit gespeichertem Passwort), klickst aber nicht auf Verbinden, sondern fällst tot um.
User avatar
fabiochelly
Power Member
Power Member
Posts: 603
Joined: 2003-02-05, 12:03 UTC
Location: Rambouillet, France

Post by *fabiochelly »

AFAIK there can't be two files with the same name (a directory is a file, too) in one dir
That's true but in this case, it's not the same dir (if orange is a file, the destination dir is c:\apple\ and if orange is a folder, the dir is c:\apple\orange\).
So the confusion come from that when you copy one file with TC, you can copy it to another dir but also as another filename.
Fabio Chelly.
#60241
Lorsqu'on s'occupe d'informatique il faut faire comme les canards...
Paraître calme en surface et pédaler comme un forcené par en dessous
User avatar
CADweazle
Senior Member
Senior Member
Posts: 297
Joined: 2003-04-03, 09:10 UTC
Location: Freiburg i.Br. Deutschland

Post by *CADweazle »

To make things even more complex:
rename in this situation a file orange.txt in dir apple to orange. - what happens? - the directory orange will be replaced by the file orange when the dir is empty and if orange is not empty the file orange will be moved to the dir orange!

So Hacker is right: dirs are treated as files - and vice versa!!

IMO Christian did this special behaviour intentionally - but a request box wouldn't be wrong in this case too... 8)

Greetings, (a member at last :wink:)
Cheer up, Karl
jb
Senior Member
Senior Member
Posts: 412
Joined: 2003-02-09, 22:56 UTC
Location: Switzerland

Post by *jb »

Hacker wrote:AFAIK there can't be two files with the same name (a directory is a file, too) in one dir.
A directory is not a file and vice versa, but they definitely share the same namespace in Windows (as variable names and function names do in most programming languages).
jb
Senior Member
Senior Member
Posts: 412
Joined: 2003-02-09, 22:56 UTC
Location: Switzerland

Post by *jb »

I think the behaviour of TC as described by Black Dog is quite strange or even a bug, because TC changes the target directory implicitly :!: At least TC should issue a warning.
But in my opinion the behaviour of the Windows Explorer is more reasonable in this point, because files and directories are conceptionally quite different. So if someone really wants to replace a directory by a file with the same name or vice versa then he/she should delete the previous object explicitly.

BTW: In the reverse case (copy/move directory into a directory that already contains a file with same name) TC gives an error message that is not very informative. This message should be improved as well.
User avatar
Hacker
Moderator
Moderator
Posts: 13068
Joined: 2003-02-06, 14:56 UTC
Location: Bratislava, Slovakia

Post by *Hacker »

A directory is not a file and vice versa
AFAIK everything is a file. A directory is just a file with some dir flag set that contains only the names of other files.

Roman
Mal angenommen, du drückst Strg+F, wählst die FTP-Verbindung (mit gespeichertem Passwort), klickst aber nicht auf Verbinden, sondern fällst tot um.
jb
Senior Member
Senior Member
Posts: 412
Joined: 2003-02-09, 22:56 UTC
Location: Switzerland

Post by *jb »

Hacker wrote:AFAIK everything is a file. A directory is just a file with some dir flag set that contains only the names of other files.
From an even lower level view you could argue: Everything is a set of bits. A directory is just a persistent set of bits with ... (add some constraints here) similar to a partition or a file, but that's not the point.
Conceptionally (from the user view) a directory differs considerably from a file (and a partition). It's just more precisely to say that directories and files share the same namespace on Windows (incl. FAT/NTFS). You can easily imagine that another OS/FS combination does not have this restriction.
User avatar
Hacker
Moderator
Moderator
Posts: 13068
Joined: 2003-02-06, 14:56 UTC
Location: Bratislava, Slovakia

Post by *Hacker »

jb,
It's just more precisely to say that directories and files share the same namespace on Windows (incl. FAT/NTFS). You can easily imagine that another OS/FS combination does not have this restriction.
Well, UNIX and Linux do, too.


Black Dog.
Anyways, this is what you get when you mix apples and oranges.

Roman
User avatar
Black Dog
Power Member
Power Member
Posts: 1024
Joined: 2003-02-05, 22:17 UTC
Location: Odessa
Contact:

Post by *Black Dog »

[face=courier]On 29-07-2003 12:16:13 +0000 Hacker wrote:

H> Anyways, this is what you get when you mix apples and
H> oranges.


Actually, I'll get a fruit salad :))). Or you wanna say it's even worse than meat and potatoes mix? LOL
BTW still can't get what's wrong with mixing them, looks like a special joke for American internal use... %)[/face]
User avatar
Black Dog
Power Member
Power Member
Posts: 1024
Joined: 2003-02-05, 22:17 UTC
Location: Odessa
Contact:

Post by *Black Dog »

[face=courier]Well, almost half of a year passed and not a single word from C.G... %\[/face]
User avatar
Sheepdog
Power Member
Power Member
Posts: 5150
Joined: 2003-12-18, 21:44 UTC
Location: Berlin, Germany
Contact:

Post by *Sheepdog »

Today I tried to overwrite a folder 'c:\totalcmd' with my backup 'c:\totalcmd.1' by renaming 'c:\totalcmd.1' - so I wouldn't have to delete the Folder before rename the other.

But it's real annoying - my backup- copy is moved into the other folder. I noticed it only by the speed - it was nearly immedately done.

I think there should be a dialog that asks me if I want to overwrite the existing folder or if I want to move the other one.

sheepdog
"A common mistake that people make when trying to design something
completely foolproof is to underestimate the ingenuity of complete fools."
Douglas Adams
Post Reply