Long file names when exporting data

Hi there,

We perform a nightly export of Octopus content using the Octopus.Migrator tool.
We hit an issue this week where the file path of one (of the many) items it creates on disk failed because the filepath was over 260 characters.

Specificially, the file path was
C:\windows\temp\20180611\Projects\UK_CYGNET_PPPSPostilionHostImport_QueueSetup\UK_CYGNET_PPPSPostilionHostImport_QueueSetup - MSMQ - Create Transactional Queues if not present - MSMQ - Create Transactional Queues if not present - Script.ps1.meta

Error message from the Migrator tool was:
System.IO.DirectoryNotFoundException: Could not find a part of the path ‘C:\windows\temp\20180611\Projects\UK_CYGNET_PayPoint.Utilities.MessageRouter_QueueSetup\UK_CYGNET_PayPoint.Utilities.MessageRouter_QueueSetup - MSMQ - Create Transactional Queues if not present - MSMQ - Create Transactional Queues if not present - Script.ps1.meta’.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
at System.IO.FileStream…ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize)
at Octopus.Shared.Util.OctopusPhysicalFileSystem.Replace(String oldFilePath, Stream newStream, Int32 overwriteFileRetryAttempts)
at Octopus.Migrator.ExportProcess.ExportWriter.WriteAnyObjectToFile(String directory, String filename, IId obj)
at Octopus.Migrator.ExportProcess.ExportWriter.WriteFile(String directory, String filename, IId obj)
at Octopus.Migrator.ExportProcess.ExportController.WriteScriptMetadata(String directory, String filename, ScriptMetadata metadata)
Created C:\windows\temp\20180611\Channels\UK_CYGNET_PayPoint.Utilities.MessageRouter_QueueSetup\Default.json
Created C:\windows\temp\20180611\Projects\UK_CYGNET_PayPoint.Utilities.MessageRouter106_QueueSetup\UK_CYGNET_PayPoint.Utilities.MessageRouter106_QueueSetup.json
Created C:\windows\temp\20180611\Projects\UK_CYGNET_PayPoint.Utilities.MessageRouter106_QueueSetup\UK_CYGNET_PayPoint.Utilities.MessageRouter106_QueueSetup-VariableSet.json
Created C:\windows\temp\20180611\Projects\UK_CYGNET_PayPoint.Utilities.MessageRouter106_QueueSetup\UK_CYGNET_PayPoint.Utilities.MessageRouter106_QueueSetup-DeploymentProcess.json
Reader took 211150ms (12ms until the first record) in transaction ‘’: SELECT *
FROM dbo.[Project]
ORDER BY [Id]

This was related

  • to a project with name: UK_CYGNET_PayPoint.Utilities.MessageRouter_QueueSetup
  • to a step with name: MSMQ - Cr​eate Transactional Queues if not present

Note that the step consumes a step template.

I guess I’ve a couple of questions related to the long file path:

  • Why is the project step name repeated in the file path (is it something to do with the fact that the step uses a step template)?
  • Is there anything we can do about these long names other than ensure we use short(ish) projects and step names?

Thanks.

Hi Adrian

Thanks for getting in touch! Sorry that we haven’t replied to this one - it fell through the cracks.

The step name duplication is actually the step name and the action name. These are usually the same, but are different when its a child step.

What version of Octopus are you running? It appears we fixed the long path support in December last year, and it was released in version 4.1.6.

If you’re on an earlier version than that, I’d recommend updating. If you’re already on a newer version, please let me know and I’ll investigate further.

Hope that helps!

Regards,
Matt

Cheers for the response - we’re on 2018.4.1 now.

I’ll await any further info you might have.

Thanks.

Hi Adrian

Hmmm. That is odd. Can you let me know what operating system you’re running on? Also, can you confirm that long path support is enabled in group policy?

Thanks,
Matt

Hi, sorry for delay getting back. We are on Server 2012 R2. Looks like long path support only available from Server 2016?

Hi Adrian

It seems you’re right - its only Windows 10 and Windows Server 2016 and above. Much harder to find that information than it should be.

From here, it looks like you’ve got a couple of options:
a) upgrade the server to 2016 (easier said than done, I’m sure!)
b) rename the projects to have shorter names
c) setup a secondary HA node (but don’t start it) on a windows 10/win 2016 box, so that can run the exporter with full paths

I suspect that option b will be substantially easier than option a, and option c is probably a non-starter.

Personally, I’d suggest going with the rename approach until you’re able to get the server upgraded. Interestingly, it looks like Server 2012 R2 is heading towards End of Life soon, so that adds another dimension to the issue as well.

Hope that helps!

Regards,
Matt

Thanks Matt. Yep - seems like a good summary of options.

I suggest you Long Path Tool will let you easily delete, copy or rename long path files, you can try it for better service.

1 Like

Use Long Path Tool, Long Path Tool can simplify and probably end your problems in unlocking, managing and renaming files that appear to have a long filename.