Powershell: directory name must be less than 248 characters

Może się przyda

Udało mi się obejść, prymitywnie, ale udało się, ograniczenie powershella

Mianowicie to: 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

Zamiast: Remove-Item na końcu robię Move-Item do innego folderu i nie wywala błędu długich nazw

A poleceniem dosowe rmdir nie ma problemu z kasowaniem długich ścieżek, plików

[sourcecode language=”powershell”]
Cmd /C "mkdir R:\DO_SKASOWANIA"
Get-ChildItem -Path "R:\BACKUP" | Where-Object { $_.CreationTime -lt (Get-Date).AddDays(-5)} | Move-Item -Destination "R:\DO_SKASOWANIA"
Cmd /C "rmdir /S /Q R:\DO_SKASOWANIA"[/sourcecode]

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>