remove-item directory and contents

This topic contains 1 reply, has 2 voices, and was last updated by  Simeon Iksanov 2 years, 1 month ago.

  • Author
    Posts
  • #28523

    Shane Lindberg
    Participant

    I am trying to delete a directory using an admin powershell but am getting this error

    PS C:\windows\system32> Remove-Item .\Macromed -Recurse -Force
    Remove-Item : Cannot remove item C:\windows\system32\Macromed\Flash\Flash64_18_0_0_232.ocx: Access to the path
    denied.
    At line:1 char:1
    + Remove-Item .\Macromed -Recurse -Force
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : InvalidArgument: (Flash64_18_0_0_232.ocx:FileInfo) [Remove-Item], ArgumentExcepti
        + FullyQualifiedErrorId : RemoveFileSystemItemArgumentError,Microsoft.PowerShell.Commands.RemoveItemCommand
    Remove-Item : Cannot remove item C:\windows\system32\Macromed\Flash: The directory is not empty.
    At line:1 char:1
    + Remove-Item .\Macromed -Recurse -Force
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : WriteError: (Flash:DirectoryInfo) [Remove-Item], IOException
        + FullyQualifiedErrorId : RemoveFileSystemItemIOError,Microsoft.PowerShell.Commands.RemoveItemCommand
    Remove-Item : Cannot remove item C:\windows\system32\Macromed: The directory is not empty.
    At line:1 char:1
    + Remove-Item .\Macromed -Recurse -Force
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : WriteError: (C:\windows\system32\Macromed:DirectoryInfo) [Remove-Item], IOExcepti
        + FullyQualifiedErrorId : RemoveFileSystemItemIOError,Microsoft.PowerShell.Commands.RemoveItemCommand

    What do I need to be doing differently?

  • #28527

    Simeon Iksanov
    Participant

    maybe file is in use?

You must be logged in to reply to this topic.