Page 1 of 1

Path Too Long

Posted: Tue Aug 04, 2015 11:54 am
by waynecierkowski
I am writing code to modify files contained on our file servers. A majority of our users work from MAC's and they have created folder structure that exceeds the 260 character limit.

I am able to get into the folder using Cmdlet's from a module called NTFSsecurity which has a Get-ChildItem2 cmdlet. It also has a Remove-Item2 and Get-Item2 both able to work with longer paths. But the module does not have an alternative method for Add-Content.

I need a way to write to the file in question contained in this long path. I have been searching for days and have come up empty.

Anyone have any ideas as too how I can write to a file contained in a long path structure?

Thanks in advance for any and all help...

Wayne

Path Too Long

Posted: Tue Aug 04, 2015 11:55 am
by SAPIEN Support Forums
This is an automated post. A real person will respond soon.

Thank you for posting, waynecierkowski.

Here are some hints to help you get an accurate and complete answer to your question.

Ask in the best forum: If you asked in the wrong forum, just copy your question to the right forum.

Anticipate follow-up questions!

Did you remember to include the following?
  • 1. Product, version and build
    2. 32 or 64 bit product
    3. Operating system, e.g. Windows 7 64 bit.
    4. Attach a screenshot, if applicable
    5. Attach logs, crash reports, etc., in a ZIP file
If not, please take a moment to edit your original post or reply to this one.

*** Make sure you do not post any licensing information ***

Re: Path Too Long

Posted: Tue Aug 04, 2015 12:09 pm
by jvierra
Start by mapping a drive to the users folder then you an just use normal commands.

New-PsDrive X FileSystem \\server\share\userfolder

That usually is enough.

Re: Path Too Long

Posted: Wed Aug 05, 2015 6:13 am
by waynecierkowski
I tried this out in the PowerShell console and I still get the same error, The specified path, file name, or both are too long...

Re: Path Too Long

Posted: Wed Aug 05, 2015 9:32 am
by jvierra
waynecierkowski wrote:I tried this out in the PowerShell console and I still get the same error, The specified path, file name, or both are too long...
Map the path further down.

Re: Path Too Long

Posted: Thu Aug 06, 2015 11:37 am
by waynecierkowski
Maybe I'm missing something but I tried mapping down further in the folder tree and I still get the error.

I've attached a screen shot of my PS Session where I tried this.

Re: Path Too Long

Posted: Thu Aug 06, 2015 11:46 am
by jvierra
You are going to have to install Mac support on the server. The issue is most likely due to illegal characters in the filenames. The Mac support, in most case, makes this work correctly.

This is not really a scripting issue. It is a compatibility and deployment issue.

Re: Path Too Long

Posted: Thu Aug 06, 2015 11:57 am
by waynecierkowski
Not really. I have it working and I discovered the solution in the help section for New-PSDrive in PowerShell studio.

Please see the attached screen shot.