1

When I on my Mac run

FileManager.default.fileExists(atPath: path)

the resulting check is case-insensitive. So filePath will return the same as FiLePaTh. I need it to do a case-sensitive check however. Is there any way of achieving this?

I am running this on macOS 12.3 on an APFS formatted volume.

Hans
  • 2,354
  • 3
  • 25
  • 35
  • This depends on how your HD was formatted – Leo Dabus Feb 17 '22 at 23:15
  • https://stackoverflow.com/questions/15121210/how-can-i-read-write-and-check-case-insensitive-filenames-in-ios + https://support.apple.com/lv-lv/guide/disk-utility/dsku19ed921c/mac What's your current HD settings? – Larme Feb 17 '22 at 23:17
  • `APFS: Uses the APFS format. Choose this option if you don’t need an encrypted or case-sensitive format.` – Leo Dabus Feb 17 '22 at 23:17
  • Resuming if your HD is formatted APFS it is NOT case sensitive. What you need is `APFS (Case-sensitive): Uses the APFS format and is case-sensitive to file and folder names. For example, folders named “Homework” and “HOMEWORK” are two different folders.` – Leo Dabus Feb 17 '22 at 23:18
  • I know that my drive is not case sensitive. It is however case preserving. That means Homework and HOMEWORK would reference the same folder but their case would still be stored. And I need to check if the stored name is the one I have in a string. Fortunately this helped me: https://stackoverflow.com/questions/45878188/checking-case-sensitive-file-name-hfs – Hans Feb 18 '22 at 14:39

0 Answers0