Wednesday, October 14, 2015

windows - Cannot remove folder. The file name or extension is too long while copying an extracted folder from its original location to another location



I use this Object Relational Mapping (ORM) framework namely Hibernate to develop Java EE applications which is available as a downloadable zip file for windows having several deeply nested directory structures.


Extracting this zip file at a location with the shortest possible path is necessary. Otherwise, the process extracting the zip file continues with several such warnings as shown below.



! F:\path\to\location\hibernate-release-5.0.6.Final.zip: Cannot create hibernate-release-5.0.6.Final\documentation\javadocs\org\hibernate\boot\model\source\internal\hbm\class-use\RelationalValueSourceHelper.AbstractColumnsAndFormulasSource.html


Total path and file name length must not exceed 260 characters
The system cannot find the path specified.


In order to avoid this type of warnings, I first copy the zip file to a location having the shortest possible path like C:\ and then extract that zip file to that location. The process extracting the zip bundle then succeeds without giving a warning like that.


A problem however, occurs, when the extracted folder is attempted to be copied from the location where it was extracted i.e. C:\ to another location, the process copying the folder terminates abnormally / abruptly in a short while with the following error.



Cannot remove folder hibernate-enhance-maven-plugin: The filename or
extension is too long.



enter image description here


The folder itself can safely be deleted from that location i.e. C:\ but it cannot be copied to another location (copy & paste thus, not cut & paste)


What is the rescue?




I am using Microsoft Windows XP Professional Version 2002, Service Pack 3.


Answer



Based on this post and this post, try 7-zip. Not only can it unzip files, it can also navigate your folders and let you delete files with the "filename too long" issue. (If it's still an issue, hold the shift key while deleting. This will prevent windows from trying to move it to the recycle bin first.) 7-zip also has a "Copy to..." and "Move to..." dialog under the "File" menu.


No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...