3

This question has been asked, but unfortunately none of the suggestions worked.

Here is the situation--the file is synced to a local folder on my computer in my /users folder from Google Drive. It is a pdf (looks like a saved receipt from somewhere). The name is >255 characters which throws Windows off.

What the file will not do

  • Open
  • Copy
  • Rename
  • Move
  • Paste
  • show properties

Actually I have not gotten the file to provide any sort of response besides the same error at all.

Solutions tried:

  • dir /x --no shortname is listed, it simply repeats the regular name.
  • Using FileBoss, Explorer++, 7zip
  • rmdir /S /Q <dir> doesn't really work since it is in my user folder...

If anyone has an idea to try, I'd be open to it.

Edit--In this instance the file name itself is greater than 255 characters. Changing the directories it is nested in will not affect the problem since there is no issue with the file path. (This problem in itself eliminates many other solutions).

7
  • 1
    Have you tried all the solutions suggested? You listed three. Out of well over a dozen. For example, UNC paths should work.
    – Bob
    Commented Jun 10, 2013 at 5:56
  • You write you tried rename; did you also try a wildcard rename? ren *.ex1 short.ex2 [And i assume you made a typo in your question, it says '<255' instead of '>255']
    – Jan Doggen
    Commented Jun 10, 2013 at 6:40
  • If you are able to write a little program to do the rename you could try the \\?\ trick mentioned in msdn.microsoft.com/en-us/library/windows/desktop/…
    – Jan Doggen
    Commented Jun 10, 2013 at 6:45
  • Possible duplicate of superuser.com/questions/489850/… Here it suggest "renaming the containing folder name(s)" so that eventually the full file spec is shorter than 255
    – Jan Doggen
    Commented Jun 10, 2013 at 6:47
  • Not to mention the many results Googling for "rename windows long file name 255"...
    – Jan Doggen
    Commented Jun 10, 2013 at 6:48

5 Answers 5

2

I would boot into a Linux Live Disc, mount your Windows drive and remove it using Linux/Unix.

I think the main commands you would need are:

mount -t ntfs-3g /dev/sdX# /mnt
cd /mnt/Users/You
rm -f further/loc/away.filename

(Note: you may need to run fdisk -l to locate your Windows partition)

and that should get you there. I had to do that at some point in time as well.

1
  • This worked for me. Thanks for the suggestion, I booted to PartedMagic, and had no problems. This is the easiest solution by far.
    – iamwpj
    Commented Jun 14, 2013 at 23:37
2

On Windows simply use the 7z file manager or any other explorer(-like) application that uses Unicode versions of API for file handling. Duplicates and further information:

(1) Technical background of the issue: The MAX_PATH limit (see also (4)).

(2) How to overcome this limit on a programmer level.

(3) How to overcome this limit on a user level.

Please be aware that (3) is ONLY a workaround. It is by no means in any way suitable for programming. The worst part is that the guys at Microsoft are mixing APIs which may lead a fully UNC-path-compatible application back to 260-MaxPath-StoneAge because of only one call to an incompatible API (cf. (2)). The Explorer and other products (including cmd & powershell) from Microsoft may never overcome this issue due to their history (the votings under the links for eliminating the limit are either ignored or declined).

Depending on the use case and version the limit seems to vary. Windows 8 Explorer seems to be able to handle around 4 times longer paths (4) whereas from Windows 7 onwards the longest file path allowed to be moved to the Recycle Bin decreased from 259 to 215 (5). Why the programmers starting from scratch with Windows NT didn't implement a dynamical allocation remains a riddle. An approach for todays situation using Non-Unicode API is described here(copy).

Other topics related to programming and UNC paths in the SO-network:

6 UNC paths in Java and its realization on JVM level.

7 & 8 UNC paths in networking.

Cases I came across where this limit is really annoying:

  • Organizing source code hierarchies: nodeJS

  • Backing up files in deep nested folder structures

  • Naming convention for documents (e.g. papers which have a long description - Abstract, Authors, Title, DOI - as their name for rapid search and find)

  • Sharing files between Linux (which doesn't have this limit) and Windows

0
0

You might want to try to take ownership of the file and see if you're able to delete it. You can do this by right-clicking the file: Properties -> Security -> Advanced -> Owner -> Edit and then change owner to your username (or Administrators group).

For more information, check this out.

3
  • Thanks, but I cannot view properties of the file.
    – iamwpj
    Commented Jun 12, 2013 at 3:24
  • @iamwpj What error do you get when you try to view the properties of this file?
    – Muneeb M
    Commented Jun 13, 2013 at 7:33
  • None, there is no option to view properties. The file is entire inaccessible.
    – iamwpj
    Commented Jun 14, 2013 at 15:38
0

This is what worked for me in a similar situation:

First attempted this to take ownership:

takeown /r /d y /f my_folder

This didn't work for some files. Then I used cygwin which I already had installed and simple ran:

rm -rf path/to/my_folder

Voila, gone.

0

If the file originated from Google Drive, why not delete it using one of the interfaces to Google drive (web, Android, etc.), or rename it there?

You must log in to answer this question.

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