Pages

Tuesday, November 8, 2016

Unable to move, copy or rename a long file name on a Windows file server – error message: “The filename or extension is too long.”

Ran into an interesting problem this week that seemed trivial but ended up causing quite a bit of headache so I thought it would be great to write this short blog post in case someone else runs into the same issue.

Problem

You’ve noticed that one of your file servers contain a file that has a name too long to move or copy to another destination because the following message is presented when an attempt is made:

The file name(s) would be too long for the destination folder. You can shorten the file name and try again, or try a location that has a short path.

clip_image002

Reviewing the file name shows that it is extremely long:

image

This file name is so long that the server doesn’t provide the choice to rename it and it would fail even if an attempt is made to copy it onto the C drive:

image 

Note the only options available in the screenshot above when you right click on the file are:

  • Open with
  • Send to
    • Compressed (zipped) folder
    • Desktop (create shortcut)
    • Mail recipient

Attempting to use the command prompt to rename the file would throw the following error:

The filename or extension is too long.

image

Other troubleshooting steps that were tried but yield the same results are as follows:

  1. Copy and paste to a higher level folder (no surprise as copying it to the C drive which would have generated the shortest path did not work)
  2. Copying to the desktop
  3. Copying to another network drive
  4. Renaming a top level folder
  5. Attempting to open the file with Adobe Acrobat so we could resave it

Solution

After trying to other steps such as renaming the top level folders and not being able to, what we found was that if we used an application such as WinRAR to compress the file into a .rar file, we would then be able to rename it to a shorter file name within the compressed file, then extract the new renamed file back onto the file server.

Hope this helps anyone who may encounter such an issue on their file server.

5 comments:

Unknown said...

I find robocopy works great for this situation.

Naz said...

Total Commander is the king of Windows file managers.

damien207 said...

I am suggesting "Long Path Tool" program that solves file name too long issues with simplicity.

John Stephen said...


hi, you can also try “Long Path Tool” it really works for me. It is free and easy to utilize.

Dan peterson said...

Long path tool is very popular software! When cleaning files from a Windows Operating System (OS), you are halted with errors relating to the filename or the file path being too long.
This is due to a 255/260 character limit on Windows Operating Systems preventing the files in a directory from being removed.
You can used Long path tool?