0

I built a new computer from ebay scraps after my laptop died. I began transferring files from my old hard drive (Windows XP to Windows 10) and ran into an issue where I could not either move or delete some of my old files. I received an error that file names were too long.

  1. First I tried renaming the files.

    Result: For some reason, the files would not rename. I checked and they were not Read Only...A weird mystery.

  2. I researched this forum and changed Windows to accept Long File Paths.

    Result: While the long file paths were a contributing factor, the real issue were the names of the files themselves. I still couldn't move or delete these files.

There had to be some legacy setting that allows long file names (example: royalty-free-photograph-of-student-chemistry-biology-bottle-science-BGBB5A)

The question is this: Is there a legacy setting in Windows 10 that will allow me to work with these files?

4

2 Answers 2

3

You should be able to manipulate them using the old 8.3 filename, which is available from CMD. For example, enter dir / at root and you should see the following.

CMD to manipulate long filenames

You can perform operations such as copy or delete on PROGRA~2, a synonym for Program Files (x86), for example.

You can also use wild cards, particularly helpful where a filename has an illegal character.

That said, often the issue is an excessively long path, i.e. drive + full file path + filename longer than 260 characters. You can make Windows 10 handle longer paths by setting the Registry value LongPathsEnabled in HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem to 1, or back to 0 to revert behavior.

  • Press Windows, type rege and select Regedit.
  • Accept the UAC prompt.
  • In the location bar, enter HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem (copy and paste from here to make it easier) and press Enter.
  • If the value LongPathsEnabled does not show in the right pane, right-click, select New> New DWORD (32-bit) Value, and copy the value name above.
  • Double-click the value and set it to 1.
0

My workaround (Windows 10) was to 1) enable long file paths in Windows and 2) use the WSL2 bash command cp -R to do the actual copying. (I am not sure if step 1) was necessary, but the combination worked for me).

1
  • Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
    – Community Bot
    Feb 3, 2023 at 0:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .