I downloaded two files, they were both saved to the same filename and then I transferred them with scp to another computer.
Why didn't they become one when the second was saved?
I downloaded two files, they were both saved to the same filename and then I transferred them with scp to another computer.
Why didn't they become one when the second was saved?
Maybe they only look like they have the same name.
Try:
$ touch Stéphane Stéphane Stéphane\ Stéphane
$ ls -1
Stéphane
Stéphane
Stéphane
Stéphane
They look pretty much the same.
$ ls -1b
Stéphane
Stéphane
Stéphane
Stéphane\
Slightly better. The space character is flagged as \ (though not all ls implementations do that).
$ LC_ALL=C ls -1b
Ste\314\201phane
St\303\251phane
St\303\251phane\
St\342\200\213\303\251phane
Now we're talking (all non-ASCII characters are rendered as the octal value of their byte constituents)
You could also do, and that works for any input:
$ ls | LC_ALL=C sed -n l
Ste\314\201phane$
St\303\251phane$
St\342\200\213\303\251phane$
St\303\251phane $
Here, the end of lines is marked with $ which makes it easier to spot the trailing space. However, that won't help spotting a file called Stéphane<newline>Stéphane
$ ls | perl -Mopen=locale -MUnicode::UCD=charinfo -lpe '
s/[^\41-\177]/"<".charinfo(ord$&)->{name}.">"/ge'
Ste<COMBINING ACUTE ACCENT>phane
St<LATIN SMALL LETTER E WITH ACUTE>phane
St<ZERO WIDTH SPACE><LATIN SMALL LETTER E WITH ACUTE>phane
St<LATIN SMALL LETTER E WITH ACUTE>phane<SPACE>
Makes it clearer what happened.
See also this other answer for more on the subject.