Skip to content

Instantly share code, notes, and snippets.

@WillYuum
Created February 11, 2026 14:07
Show Gist options
  • Select an option

  • Save WillYuum/a8afa3d27e53c726d93edba7a9502a11 to your computer and use it in GitHub Desktop.

Select an option

Save WillYuum/a8afa3d27e53c726d93edba7a9502a11 to your computer and use it in GitHub Desktop.
<#
-----------------------------------------------------------------------
remove-macos-metadata.ps1
Purpose:
Removes macOS-specific metadata files and directories that are often
included unintentionally in asset packs and ZIP archives created on macOS.
Common examples include:
- .DS_Store files
- __MACOSX directories
These files are used by macOS Finder for metadata storage and are safe
to delete on Windows, Linux, and in game or asset pipelines.
Usage:
pwsh ./remove-macos-metadata.ps1 <path>
Example:
pwsh ./remove-macos-metadata.ps1 C:\Users\[USER]\Downloads\Tiny_Swords_Packed <------ Asset pack I was using
The script will:
- Recursively scan the given directory
- Log every file or folder it deletes
- Force removal without prompting
-----------------------------------------------------------------------
#>
param(
[Parameter(Mandatory = $true)]
[string]$Path
)
if (-not (Test-Path $Path)) {
Write-Error "Path does not exist: $Path"
exit 1
}
Write-Host "🧹 Cleaning macOS metadata in: $Path"
$items = Get-ChildItem $Path -Recurse -Force |
Where-Object {
$_.Name -eq ".DS_Store" -or $_.Name -eq "__MACOSX"
}
if ($items.Count -eq 0) {
Write-Host "✨ No macOS metadata found."
exit 0
}
foreach ($item in $items) {
Write-Host "🗑️ Removing: $($item.FullName)"
Remove-Item $item.FullName -Recurse -Force
}
Write-Host "✅ Cleanup complete. Removed $($items.Count) item(s)."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment