"You can’t copy “_IMG_3815.JPG” because it has the same name as another item on the destination volume...."

I'm having a big problem copying some large directories from my NAS to a drive on my Mac. I know you can format case sensitive but I didn't and I cannot go back now because I am in the middle of a very long job. I also remember someone here telling me that there is a good reason not to use case sensitive for Macs and it sounded plausible but I don't remember the reason.


My NAS is using ext4. It is only storing data I drag and dropped to it from my Macs so it must be some kind of corner case where a couple files got this conflict. Maybe I was renaming on them on the NAS and I made a typo. Who knows. There are not very many but they kill my hours long copy process in the middle with no way to just say "skip" or "ignore" and it leaves me with no good way to pick up where I left off. This is really stupid behavior of the OS, by the way.


Is there some kind of tool I can use to search the NAS shared drive to find all of these conflicts and fix them before starting my next big copy job?


"You can’t copy “_IMG_3815.JPG” because it has the same name as another item on the destination volume, and that volume doesn’t distinguish between upper- and lowercase letters in filenames."

Mac mini, macOS Sierra (10.12.3), null

Posted on Mar 10, 2017 2:53 AM

Reply
7 replies

Mar 10, 2017 4:04 AM in response to brsm1990

It sure sounds as if you have two (or more) files on the NAS whose names differ only on the capitalization - like

“_IMG_3815.JPG” and “_IMG_3815.jpg”.

The default on the mac is to use a case-insensitive format, which does not allow for the above.

What I'd do is to make a little script to traverse the directory tree you want to copy in the NAS and look for this kind of situation. In a first run, I'd just have it write out the conflict cases.

I have to run now, but if you need help with this let me know. Later today I could have a look at it.

Mar 13, 2017 6:33 AM in response to brsm1990

Ok, here is a first attempt. This version is not perfect. It may yield false positives, in case there are files with equal names in different folders, but it may be enough if the number of repeats is small.


What it does: it looks at the directory tree below the start folder, list all the files and print only those that appear more than once (in a case insensitive comparison). It has two defects:

1) it does not say where the repeated files are (but see (*) for a solution for this);

2) it will count as a repeat even if the files appear in different folders (if there are too many of those "false positives", let me know and I'll try to improve this; if there are only a few, it should be ok)


How to use:


1) Copy the following line and paste it somewhere where you can make an easy edit:


find <<start>> -type d -exec ls {} \; | tr '[:upper:]' '[:lower:]' | sort | uniq -d > duplicates.txt


2) Replace <<start>> with the pathname to the folder in your NAS where you want to search

(if you don't know how to do this: open a Terminal window and just drag that folder there; then copy and paste it so it replaces <<start>> in the line above)


3) Copy the modified line, paste it into Terminal and press Enter. What a little (it may take a few seconds or maybe more, depending on the size of the directory tree). A file named duplicates.txt will be created (in your home folder unless you change the directory in Terminal). Double-click it and see the names of the "duplicate" files.


(*) To actually find the duplicate files, you can issue this command in Terminal - replace <<file>> with one of the names you get from the duplicates.txt file, and <<start>> as above:


find <<start>> -ilname <<file>> -print

Mar 13, 2017 8:31 AM in response to Luis Sequeira1

This is almost what I want to do but not quite. I probably didn't make it clear enough but I only want to find duplicates that are in the same folder.


For example


/photography/Europe_2016/sample001.jpg and /photography/Europe_2016/Sample001.jpg (or sAmple001.jpg, SAMPLE001.jpg, sample001.JPG, etc.) I want to show up...

But


/photography/Europe_2016/sample001.jpg and /photography/Europe_2016/websize/Sample001.jpg


should not show.

Right now any file with the same name is (with or without differences in case) anywhere in the entire tree is showing up on the list.


I suppose that there is an easy way to adjust this command to do what I need it to?


I have tons of photos where I edited the photo and then saved it in a sub directory called "edited" or "websize" under the same name as the original file and those are generating lots of hits but those are not problems for me. It's only a problem when they reside in the same directory and only differ in name by case.


Thanks a lot!

Mar 13, 2017 8:15 AM in response to brsm1990

Yes, I am aware of the limitations of my proposed solution. I did not explore this very deep, and I am sure one can improve it. That is why I spoke of "false positives" - they are precisely those files with the same names, but in separate folders. I was hoping that there might be only a small number of those, and they could be easily distinguished from the real positives.


I will think a little more about this and hopefully I can give a solution 2.0 without the above defect.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

"You can’t copy “_IMG_3815.JPG” because it has the same name as another item on the destination volume...."

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.