Score:1

Having trouble copying conda environment folder containing same word (different case) files with symbolic links in terminfo subdirectory

dm flag

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.

hr flag
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)
muru avatar
us flag
Why are you making the copy in the first place? Is it for backing up? If so, why not use a tar archive?
Elijah avatar
dm flag
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.
NotTheDr01ds avatar
vn flag
Sorry, wrote up the answer before I noticed that you'd already solved this in the comments.
Score:0
vn flag

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.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.