Skip to content

Instantly share code, notes, and snippets.

@joe-scalise
Created January 6, 2020 12:18
Show Gist options
  • Select an option

  • Save joe-scalise/c8eed26be6489d581b68fcf56d3fdc6e to your computer and use it in GitHub Desktop.

Select an option

Save joe-scalise/c8eed26be6489d581b68fcf56d3fdc6e to your computer and use it in GitHub Desktop.
Notes on Deleting Files in Windows
del /F /S /Q <target>
Deletes all files in target directory. Fastest, but will not get around permission issues or other stubborn file/folder issues, and also leaves behind directory structures.
rmdir /S /Q <target>
Helpful when removing an entire directory tree, and can be used to "clean up" the directory structures left behind from del command, but has same issues with certain files/folders.
robocopy <src> <target> /MIR | out-null
When source is made to be empty directory, use this command in PowerShell to overwrite stubborn folders/files that would not delete with above commands; slowest of the three.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment