Pregunta

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?

¿Fue útil?

Solución

Remove-Item $repoPath will remove the entire folder. Don't you mean do use Remove-Item $repoPath\*?

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top