Powershell, Path ... too long?

I have a script that I am running which is supposed to do just a simple copy of 2 folders from a system drive to an external USB HDD.
Script is attached.
This is the error I am getting and it seems to be halting the script after hitting this error a few times.  It seems pretty pathetic that Microsoft would even allow you to create a path that would be too long for their own tool to handle.  Am I doing something wrong?

Copy-Item : The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less
than 248 characters.
$SourceDir1 = "D:\Data\Users\*"
$SourceDir2 = "D:\Data\Sharing\*"
$Directory1 = New-Item -Name $((Get-Date).ToString('dd.MM.yyyy')) -Type Directory -Path "f:\Users\"
$Directory2 = New-Item -Name $((Get-Date).ToString('dd.MM.yyyy')) -Type Directory -Path "f:\Sharing\"

copy-item $SourceDir1 -destination $Directory1 -recurse
copy-item $SourceDir2 -destination $Directory2 -recurse

Open in new window

alexianitAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Domme2812Commented:
This is a general limitation in Windows, the fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.
As far as I know there is no workaround here.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Powershell

From novice to tech pro — start learning today.