Created
October 22, 2023 08:57
-
-
Save LaineZ/e708feb9235faa8fe8a635ef42075318 to your computer and use it in GitHub Desktop.
PowerShell: Clean Cargo Projects recursivly
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Change your desired path | |
$projectFolders = Get-ChildItem -Directory -Path "D:\projects" | |
foreach ($folder in $projectFolders) { | |
$projectPath = Join-Path $folder.FullName "Cargo.toml" | |
if (Test-Path $projectPath) { | |
Write-Host "Cleaning project in $($folder.FullName)..." | |
Set-Location -Path $folder.FullName | |
Invoke-Expression -Command "cargo clean" | |
Set-Location -Path $PSScriptRoot | |
} else { | |
Write-Host "No Cargo.toml found in $($folder.FullName)" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment