1

I am using WSL1.

  • I am trying to save a copy of my ~./miniconda/envs folder to the desktop using cp.

  • I keep getting errors like cp: cannot create regular file './envs/py_env/share/terminfo/h/hp2621a': File exists

  • The problem is that there are 2 files with the same name but different case. For example, hp2621a and hp2621A.


Example:

Original Folder: hp2621a, hp2621A, etc

Using cp I get:

  • New Folder: hp2621A, etc
  • Missing: hp2621a

  • Some of the subdirectories of py_env/share and py_env/lib also have a similar problem (A and a seemed to conflict)

  • I was able to solve some of these errors by changing the name of a directory from A to A_1.

NotTheDr01ds
  • 15,380
  • 6
  • 51
  • 79
Elijah
  • 11
  • 2
  • 3
    The problem is likely that your *Windows* desktop is on a filesystem that doesn't distinguish letter case by default - see for example [Differences between Windows and Linux case sensitivity](https://learn.microsoft.com/en-us/windows/wsl/case-sensitivity#differences-between-windows-and-linux-case-sensitivity) – steeldriver Dec 12 '22 at 20:51
  • Why are you making the copy in the first place? Is it for backing up? If so, why not use a tar archive? – muru Dec 13 '22 at 04:22
  • I wanted to make a copy for back up. Tar archives would have been a better option. @steeldriver was saying that the files are set as case insensitive on my desktop. fsutil query returns: Case sensitive attribute on directory C:\Users\[myusername]\desktop\envs is disabled. I can change the sensitivity. – Elijah Dec 13 '22 at 17:34
  • Sorry, wrote up the answer before I noticed that you'd already solved this in the comments. – NotTheDr01ds Dec 25 '22 at 04:26

1 Answers1

0

From the comments, it looks like you've found this already -- There's some good documentation on why this is happening and how to handle it.

By default, folders on Windows NTFS drives are case-insensitive; A and a are the same filename. However, for some time now (since 2018) Windows has the ability to specify case-sensitivity on a directory-by-directory (and inheritable) basis. To do so:

  • The directory where you place these files will need to be empty to start with. Either remove everything from the existing directory or create a new empty directory on the desktop. We'll assume the name of this directory is $env:USERPROFILE\Desktop\env.

  • From PowerShell, run:

    fsutil.exe file setCaseSensitiveInfo $env:USERPROFILE\Desktop\env enable
    

That should be all that is needed for your cp command to work properly. If not, though, see the doc page for some more options and details.

NotTheDr01ds
  • 15,380
  • 6
  • 51
  • 79