Windows has a length limit on file names when trying to delete though that will not prevent these files from being created
Our build process creates a number of temporary files many of which have been built on wsdl sites that run against this limit Our ant script is somehow able to delete them when doing a clean, but sometimes i need to delete the workarea directory (where all the temp files go) without actually doing a full clean from ant.
This is the same errors this question, but the answers there don't really work for me as i'm dealing with a directory, not a file, and i don't always know what specific files or subdirectories are causing the problem. And i'm trying to avoid any manual process other than triggering one single command to delete them actually
If I try deleting the directory from Explorer I get the error
Cannot delete [file name]: The file name you specified is not valid or too long. Specify a different file name
Remove-Item in powershell gives the following error.
Remove-Item : The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters. At line:1 char:12 + Remove-Item <<<< -force -Recurse <directory>
Is there a way to get around the delete error and move the files manually?
Use the 7-Zip File Manager to delete them.
If you are still having trouble, ensure that you utilize Shift + Delete inside the 7-Zip File Manager. Windows will try to put them in the recycle bin but this will fail again