David Mundt
asked on
Removing Folder using Powershell when it contains Illegal Filenames Created by Mac
I'm trying to remove some folders but there were files created with Mac that the filenames are too long for Windows. Does anyone know how to force a folder delete no matter what is in it.
The file names are literally a sentence.
Below is the message I'm getting on PS.
PS C:\Users\david.mundt> Remove-Item -path "E:\Shared\Client Projects\Adobe" -recurse
Remove-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.
At line:1 char:1
+ Remove-Item -path "E:\Shared\Client Projects\Client" -recurse
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~
+ CategoryInfo : WriteError: (E:\Shared\Client Projects\Client:String) [Remove-Item], PathTooLongException
+ FullyQualifiedErrorId : RemoveItemIOError,Microsof t.PowerShe ll.Command s.RemoveIt emCommand
The file names are literally a sentence.
Below is the message I'm getting on PS.
PS C:\Users\david.mundt> Remove-Item -path "E:\Shared\Client Projects\Adobe" -recurse
Remove-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.
At line:1 char:1
+ Remove-Item -path "E:\Shared\Client Projects\Client" -recurse
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : WriteError: (E:\Shared\Client Projects\Client:String) [Remove-Item], PathTooLongException
+ FullyQualifiedErrorId : RemoveItemIOError,Microsof
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Glad you solved your problem.
»bp
»bp
Glad to help. :)
ASKER
Thanks gentlemen. The Path too long tool worked for some of my folders but in the end I used
robocopy c:\empty "d:\folders I cant delete\illegal filenames" /mir
Success...
robocopy c:\empty "d:\folders I cant delete\illegal filenames" /mir
Success...
try long path tool program,very good
ASKER
robocopy c:\empty "d:\folders I cant delete\illegal filenames" /mir
Success...