I have a git repository that I’m trying to delete all files and folders out of but not the .git folder. I’ve tried various permutations of the -exclude parameter but can’t seem to get it.
$repoPath = "c:\myrepo"
Remove-Item $repoPath -Recurse -Force -Exclude .git
Remove-Item $repoPath -Recurse -Force -Exclude *.git*
Remove-Item $repoPath -Recurse -Force -Exclude *.git
No matter what I try the .git folder gets deleted. Any suggestions?
Remove-Item $repoPathwill remove the entire folder. Don’t you mean do useRemove-Item $repoPath\*?