Windows10:如何通过 powershell/命令提示符删除 .DS_STORE 文件?

mrj*_*per 3 windows windows-10

所以我在网上搜索了各种方法来删除我的 Windows 机器上的 OS X 文件(.DS_STORE 和 ._.DS_STORE)文件。

我尝试过的东西(我在互联网上找到的东西的第一个和第二个选项)

第一个选项- 使用 powershell + dir/remove-item 组合

dir D:\my-stuff\ -include "._*",".DS*" -Recurse -Force | remove-item

It finds the files but gives an error

+ FullyQualifiedErrorId : RemoveFileSystemItemUnAuthorizedAccess,Microsoft.PowerShell.Commands.RemoveItemCommand
remove-item : Cannot remove item D:\my-stuff\._.DS_Store: You do not have sufficient access rights to perform this operation.

 I then went to my drive properties and then security to give my user full control. Still the same results.
Run Code Online (Sandbox Code Playgroud)

第二个选项- 使用 powershell + get-childitem/remove-item 组合

Get-ChildItem -recurse -filter .DS_STORE | Remove-Item -WhatIf

which didn't result in any files being found.

Also tried

Get-ChildItem -recurse -filter .DS_STORE

and still didn't any files
Run Code Online (Sandbox Code Playgroud)

第三个选项- 这次使用命令提示符/del 命令

D:\>del /f /s .DS_STORE ._*
Could Not Find D:\.DS_STORE
Run Code Online (Sandbox Code Playgroud)

Ard*_*nel 5

先到cd.DS_STORE文件的文件夹

cd D:\my-stuff
Run Code Online (Sandbox Code Playgroud)

然后运行以下命令以删除.DS_Store递归调用的文件

del /s /q /f /a .DS_STORE
Run Code Online (Sandbox Code Playgroud)

或者下面的这个用于删除与通配符匹配的其他隐藏文件._,出于某种原因,您应该小心,因为您可能需要与通配符匹配的其他文件

del /s /q /f /a:h ._*
Run Code Online (Sandbox Code Playgroud)