Skip to content

Remove-Item on MacOS fails to use credentials of current user #9519

Closed

Description

@spboyer

Steps to reproduce

Remove-Item ./node_modules/ -Recurse

Expected behavior

Delete all files/folders in ./node_modules/

Actual behavior

Remove-Item : You do not have sufficient access rights to perform this operation.
At line:1 char:1
+ Remove-Item ./node_modules/ -Recurse
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : PermissionDenied: (/Users/shayneboyer/\u2026e/node_modules/.bin:DirectoryInfo) [Remove-Item], IOException
+ FullyQualifiedErrorId : RemoveFileSystemItemUnAuthorizedAccess,Microsoft.PowerShell.Commands.RemoveItemCommand

Environment data

Name                           Value
----                           -----
PSVersion                      6.2.0
PSEdition                      Core
GitCommitId                    6.2.0
OS                             Darwin 18.5.0 Darwin Kernel Version 18.5.0: Mon…
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Related to #9246 ?

Activity

  1. added
    Issue-Question
    on May 2, 2019
  2. spboyer commented on May 2, 2019

    @spboyer
    Author

    Requires -Force flag, but probably should not?

  3. usepowershell commented on May 2, 2019

    @usepowershell

    The -force enables removing hidden or read-only files/folders. I believe in this case the .bin is a hidden directory and why we see the error in removing it.

    (from the help)

    Forces the cmdlet to remove items that cannot otherwise be changed, such as hidden or read-only files or read-only aliases or variables.

  4. SteveL-MSFT commented on May 3, 2019

    @SteveL-MSFT
    Member

    Perhaps we could improve the error message if this is the case that the folder is read-only

  5. added
    Resolution-Answered
    on May 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-QuestionResolution-Answered

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions