locked
Unable to delete, or change permissions on, files with long file paths / names from (now completely lost) old domain RRS feed

  • Question

  • First, the basics:

    OS: Windows Server 2008 R2 (fully updated)

    Roles: none yet (removed the only role during troubleshooting - File Services)

    Features: ditto

    Environment: my own domain

     

    Background:

    I have a server, running Win2008R2, which plays host to three Hyper-V VMs, each also running '08 R2.  These four systems (on one box) basically run my domain.

    Recently, due to a lack of planning / foresight on my part, I lost my entire domain architecture - the HDD hosting my physical OS (the one that acted as Hyper-V host) died.  This OS was also my DC / DHCP / DNS server.

    I have now brought that system back online, and for all intents and purposes recreated my old domain.  However, as you might expect, I've run into a few snags.  The first that I've been just unable to solve is this:

    One of the virtual servers has access to a RAID disk, which hosts a number of shares.  Before the domain crash, everything was working just fine.

    In trying to get back to that state, I need to re-permission the entire file tree of the RAID disk, removing the GUIDs for the flattened domain and replacing them with valid domain accounts.

     

    Here's the problem:

    There are a few files on that disk which just refuse to cooperate.  I first noticed this in my first attempt to simply change owners globally on every file on the drive.  I had to click through probably fifty error windows telling me I couldn't do that on a specific file.  The filenames involved were too long to be fully displayed.

    I, predictably, got the same error when I tried to change the actual file permissions, now that I was owner on (most of) the drive.  Around this time, I also started getting errors that the Recycle Bin on that drive was corrupt, and asking me if I wanted to repair it.  I am unable to do so.

    So, here's a list of the things I can't do.  I think if I could do just one of them, I could solve all these problems:

    I can't take ownership of a few files in my structure.  Gut instinct, it's because the path is too long.

    Similarly, I can't change permissions on these files

    I can't delete these same files (though I was able to copy them with xcopy)

    I can't empty or repair the recycle bin (I am prompted by UAC, and then AFTER the UAC prompt, told I need permission).

     

    I'm not totally sure I'm providing enough information here, but hopefully this is a good enough start, and folks can point me at things to try.  I've exhausted my limited expertise.  At the moment, I'm concerned that the problem may be occurring because my new domain is named the same as my old domain, but the GUID's within don't match.

    Thanks in advance for any and all advice.

    Tuesday, November 29, 2011 10:06 PM

Answers

  • Hi,

    By default we cannot create file with an over-255-character path. However some programs can create file or folder without load the whole path so it will able to create such long path.

    You can test to create a junction can be consider as a workaround. For exameple, the folder path is c:\<240characters>\<40characters>\file.txt, we can create a folder c:\junction which point to c:\<240characters>, so we can run "takeown /f c:\junction\<40characters>\file.txt /a" to take ownership of the file.

    Also map a middle folder as a drive will also help on this.

    In addition, you can test to use \\?\ as a prefix to see if it can help access the long path file.


    TechNet Subscriber Support in forum |If you have any feedback on our support, please contact tnmff@microsoft.com.
    Friday, December 2, 2011 3:33 AM

All replies

  • Hi,

    By default we cannot create file with an over-255-character path. However some programs can create file or folder without load the whole path so it will able to create such long path.

    You can test to create a junction can be consider as a workaround. For exameple, the folder path is c:\<240characters>\<40characters>\file.txt, we can create a folder c:\junction which point to c:\<240characters>, so we can run "takeown /f c:\junction\<40characters>\file.txt /a" to take ownership of the file.

    Also map a middle folder as a drive will also help on this.

    In addition, you can test to use \\?\ as a prefix to see if it can help access the long path file.


    TechNet Subscriber Support in forum |If you have any feedback on our support, please contact tnmff@microsoft.com.
    Friday, December 2, 2011 3:33 AM
  • Long Path Tool helped me in that situation, you can check it on http://LongPathTool.com
    Monday, February 27, 2012 4:21 PM
  • Can’t remove/ rename/ delete/ copy file? Please look that, LONG PATH Error Fixer helped me in this situation. Actually “Long Path Tool” is so usefully for this problem. So try it today.

    Tuesday, October 23, 2012 6:59 AM
  • “Long Path Tool” is very helpful for this error !
    You can use to solve this problem.
    Sunday, August 28, 2016 9:36 AM