If macOS-created .DS_Store files remain in Windows folders, you can remove them with PowerShell. To keep the cleanup scoped, specify the target folder, review the full paths that match, and preview the operation with -WhatIf before deleting anything.
List matches and preview the operation
Replace $root with the absolute path of the folder you intend to clean. -LiteralPath avoids interpreting characters in the root path as wildcards, and -Filter selects entries named .DS_Store. -File excludes directories with that name. -Recurse searches child folders, and -Force includes hidden items.
| |
Delete only after review
The first output lists the full paths of candidate files. The following -WhatIf displays the planned deletions without performing them. Only after confirming that the list and preview are correct should you remove -WhatIf from the same Remove-Item line and run it.
Scope and permissions
This example targets files named .DS_Store under the chosen root. If you choose the wrong root, files anywhere under it may be included. -Force does not bypass access permissions. If access is denied, review the target path and your permissions.
