TransWikia.com

Why can macOS have two files with same name?

Ask Different Asked by Nan Xiao on January 27, 2021

I found there are two files with same names but one with extended attribute while the other not (Actually I used sed command to do in-place operation with one file before):

-rw-r--r--  1 nanxiao  staff   351K Sep 28 12:29 db_chunks.csv
-rw-r--r--@ 1 nanxiao  staff   351K Sep 28 09:55 db_chunks.csv

So when I open db_chunks.csv, which file is actually operated? What is the relationship with these two files?

P.S., my macOS is Catalina.

Edit:
The following is the output of ls -lb:

-rw-r--r--  1 nanxiao  staff  538150 Sep 28 12:29 pcap_chunks.csv
-rw-r--r--@ 1 nanxiao  staff  538658 Sep 28 12:25 pcap_chunks.csv

And although both are csv files, they are classified as different file formats in Finder:
enter image description here

The "Get info" of both files:
enter image description here

One Answer

You cannot have two files with the same name in the same folder.

If you look closely at the "Get Info" screenshots you've posted - there seems to be a much larger gap between the filename and "Info" on the left-most screenshot compared to the right-most screenshot.

This seems to indicate that you've probably have a space at the end of the name of one of the files. You can just rename the file in Finder to give it a separate name and remove the space.

Correct answer by jksoegaard on January 27, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP