none
Removing files with long names.

    Question

  • Hello:

    I've managed a few windows file servers over the past few years ranging from (server 200 to 2012 R2). Some of the groups in the organization that I work for have a fairly complicated categorization system for their data. Sometimes the path to a file is nested in folders with really long file names, sometimes the directory names are fairly small but the are quite a few levels of directories before you get to the target files. I've come across problems where a user is not able to delete or rename a file because the path plus the file name exceeds the 256 character limit. Normally I will either rename the long folder names to something shorter or map a drive to the parent folder to shorten the path and this has worked well in the past. 

    Recently however, I have come across a problem where the file name itself is actually over 256 characters long. In these cases I haven't really been able to do much since there is no way to shorten the path. One thing that I have tried which has worked only part of the time is to open the dos command prompt and use the dos short name instead delete the file. Like I said, this works well but mainly just when I am dealing with one single file. Sometimes I have directories full of these files so using this approach is not efficient. 

    I had read an article a while back on how windows uses internal path prefix to be able to reference drivers stored in the system even if the path to the driver files exceed the 256 character limit. It looks like the way to do that is to refer to the file using the following notation: \\?\c:\path\to\long\file\name.txt . And it is not supposed to have a limit. It does not work at the command line and when I tried that using explorer it changes the path to the regular path without the '\\?\'. 

    I have a particular file server that has TBs of these types of files that I need to delete. However, I haven't found a way to do it. I've read online about free applications that claim to do this (ie. unlocker) but I was hoping to be able to use a native OS feature to take care of this issue. I'm fairly confused as to how these files were able to be created in the first place when just the file name itself exceeds the maximum character limit? Is there a way that I can prevent this from happening? is there anything in server 2012 R2 that addresses this problem? 

    Thanks,

    RA

    Tuesday, April 29, 2014 6:58 PM

Answers

  • Hi,

    Some third party application could able to create files with long file name. For your current situation, please test if you can use CMD to show these files with 8.3 file name (short file name) and use Erase command to delete them. 


    If you have any feedback on our support, please send to tnfsl@microsoft.com.

    Thursday, May 01, 2014 5:41 AM

All replies

  • Hi,

    Some third party application could able to create files with long file name. For your current situation, please test if you can use CMD to show these files with 8.3 file name (short file name) and use Erase command to delete them. 


    If you have any feedback on our support, please send to tnfsl@microsoft.com.

    Thursday, May 01, 2014 5:41 AM
  • How are things going? Please let us know if there is any progress.

    If you have any feedback on our support, please send to tnfsl@microsoft.com.

    Wednesday, May 07, 2014 8:02 AM