When path is too long

Last weekend I run into an issue, where due to missing disk space availability my server run into back pressure.

Exchange has a feature, which will move the current mail queue file and the respective log files to another folder. This happens when transport service detects an issue with the current queue and is called QueueDatabaseRecoveryAction.


But i don’t want to dive into the issue with crashing transport service. This needs some additional investigations.

The problem is that transport service tending to create with this behavior a scenario, where you won’t be able to delete the old files and folders anymore as the path is too long:


There is no way of deleting the folder structure with the explorer or even with PowerShell. The only way to get rid of this is our good old friend Robocopy:

I used the nirroring functionality and let the tool remove all the items underneath the Messaging.old-* folder with the following steps:

  • create an empty folder (as source)
  • open an elevated PowerShell
  • run the command:
robocopy <empty source path> <path to Messaging.old-* folder> /mir

After a few minutes I reclaimed free space and Exchange was not anymore in back pressure


Nothing special, but hopefully handy for someone.

Sometimes we have to remember the good “old” tools…

11 thoughts on “When path is too long

  1. Hey Ingo with server 2016 and newer you can access long path with powershell you have to enable the feature via gpo or via regedit..
    Set-ItemProperty -Path HKLM:\System\ControlSet001\Control\FileSystem -Name LongPathsEnabled -Value 1

    after this powershell can address longpath … the explorer can’t regarding the manifest.xml

    Oryou can use the ntfssecurity ps module which comes with get-childitem2 which can address longpath as well …




    • Well it’s a 3rd party app, which might not be allowed, whereas Robocopy.exe is built-in and it also does the Job.
      I prefer my solution, but it’s only one out of multiple. If you like this tool, use it.


      • Yes its a third party tool but its work like a charm, i personally tried many times


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s