Trying to delete some files on 2016 Windows file server. Path or File name to long. will not let me delete.

Tried everything as Owner of directory w. full access

I have tried subst to shorten the path- does not work.

I have tried remove-item … - force in PowerShell - says file does not exist. (PS does see the file, I tried -include partOfFileName and in the error it spits back the complete file name)

Tried CMD rem /f - does not work “filename or ext is to long”

Tried creating a folder at root of drive cut/paste fails with “source file name larger than is supported by the file system. try moving to a location w/ shorter path name or renaming…”

I cannot move or rename it. Any ideas or suggestions would be helpful.

9 Spice ups

Have you tried a robocopy to the root folder with something like this?

robocopy source destination /E /Z /COPYALL /XO

Optional switches:

/V is a verbose output that will show you everything, even skips (like if you use /XO).

/L will not actually copy them, but will run a test a list out if it will work

/TEE /LOG:File.txt -will display what’s going on and also log it to a text file

Thanks, just tried it. Robocopy will copy them to E:test\ - but then same thing. will not delete the same files. "source file name(s) are larger than is supported by file system. try moving to a location which has a shorter path name or try renaming to shorter name(s) before attempting this operation.

Did you try this ?

Q. How do I enable long file name support in Windows 10?

A. In the past the maximum supported file length was 260 characters (256 usable after the drive characters and termination character). In Windows 10 long file name support can be enabled which allows file names up to 32,767 characters (although you lose a few characters for mandatory characters that are part of the name). To enable this perform the following:

Start the registry editor (regedit.exe)Navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystemDouble click LongPathsEnabledSet to 1 and click OKReboot

1 Spice up

Robocopy C:\EmptyFolder C:\FolderToBeCleaned /purge

1 Spice up

Zip the file into a shorter zip filename. Then look inside the zip file and rename it and then unzip it?

Installed 7zip - open the folder in app, was able to rename all affected files. Thanks everyone for your replies.

2 Spice ups

+1 for RoboCopy.

With this being supported on Windows 10, does that mean the physical system where the files exist need to be Windows 10 (or Win10-based server) or would it work on an older server if accessed via a Windows 10 workstation?

this was already enabled 7zip was the answer