Jump to content

Long Folder Names and failed defrag attempts


Steven M

Recommended Posts

Howdy,

I've been seeing an issue with defraggler where I have a VERY LONG FOLDER NAME and some small PDFs in the folder, where Defraggler cannot defrag the files.

I recently had to manage some code in VBScript to handle long file names/paths by doing something similar to:

Set objfile = objFSO.CreateTextFile "//?/d:\some\long\file\path\that\is\very\deep\etc\and\so-on/you get the idea\some.log"

... where the long folder path exceeds the 260 characters for the standard APIs to connect to a folder because of the LFNs...  The prefix of "\\?\" enables the Long File Name APIs so VB can see files in the long file name API space.  I am assuming that whatever Defraggler is written is would need somethign similar to handle long file names/paths as well.

Is it possible this is happening in Defraggler as well?  as I dont really see a reason that Defraggler is having a problem with the PDF files as they are not in use (every time I try to defragment them).

The version of defraggler doesn't seem to change the outcome as I have tried upgrading to the most recent version (v2.22.995)

HTH and thanks for any responses.

Steven M

Link to comment
Share on other sites

  • 7 months later...

I am just bumping this thread since it seem that no one responded and providing a link to help explain the issue and a workaround for Defraggler's coding issues for super long LFNs.

https://docs.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=cmd

The article explains how to enable the LFN APIS in code (getting the APIs to handle long folder/paths greater than 260 characters) as well as providing a registry edit that tells Windows to automatically enable the LFN APIs.

The following registry edit is listed in the link above and will auto-enable the LFN APIs in Windows 10 Build 1607 (as well as Server 2016) and above (making the coding of \\?\ for long directories/files unnecessary).  I personally have tested it in Windows Server 2016 since there was no traction on this thread and wanted to defragment these files.

 

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem]

"LongPathsEnabled"=dword:00000001

No reboot is required, but I would assume that you'd need to close and reopen Defraggler for it to see the Filesystem API change.

HTH Someone.

Steven

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.