Good Afternoon all,
I have a powershell script that deals with leavers - it utilizes the copy-item cmdlet but occasionally I get a copy error about long file or path names. Please could you let me know if there is anything I can use or an alternative method to deal with this?
Thanks for any help.
PowerShell utilizes the same Windows APIs that introduce this limitation, so the short answer is not using the default cmdlet/apis. Robocopy is a great alternative though, it is a solid tool that is not bothered by the long path limitation and it can be called from PowerShell.
The alternative options, to be able to do this from PowerShell are the following:
Good Afternoon Jaap,
Is there a guide on utilizing robocopy within my powershell script please?
Ahh I have just seen it is built into Windows 8 - I thought it was a seperate tool, looking at your function I guess I can just call it by using:
robocopy.exe in my script?
I will check out your function, thanks :)
There is no guide, you can just type robocopy c: d: and it will start copying. There are no additional considerations aside from different variables in PowerShell when compared to the command prompt, eg: $env:systemroot instead of %systemroot%. Have a look at robocopy /? for the variable or read more about it in this community page with some common usage scenarios:
Robocopy and a Few Examples
Let me know if you have any further questions, if you can show some of your code and what you intend to use robocopy for I can give some additional feedback.
Powershell wont help in this case I guess. You can try Robocopy but it didn't helped me at all and made the situation worse. I then tried GS Richcopy 360 which really helped me out. Solved the issue in no time. I am using its enterprise edition currently! Give it a shot and try its trial version.
Long Path Tool can eliminate the following error messages:
- Path too long
- Filename too long
- Path too deep
- Destination path too long
It also allows you to delete, copy and rename long path files.