Those who don’t learn history are bound to repeat it. I know Remove-Item -Recurse was broken.. I know it has been fixed.. I still forget it on old systems sometimes.

If you are running Windows 2008R2 or older system and want to remove directories using Powershell well Remove-Item -Recurse might sound smart but wait.. There is a little problem with that cmdlet.

<...>
    -Recurse [<SwitchParameter>]
        Deletes the items in the specified locations and in all child items of the locations.

        The Recurse parameter in this cmdlet does not work properly.
<...>

Well Microsoft has fixed that with Windows 2012.  But I still sometimes need to script on older systems, its easy to forget that its broken. If I run the same command on a Windows 2012 or 2012R2 Preview I get the following:

<...>
    -Recurse [<SwitchParameter>]
         Deletes the items in the specified locations and in all child items of the locations.

         When it is used with the Include parameter, the Recurse parameter might not delete all child directories or all child items. This is a known issue; as a workaround, try piping results of the Get-ChildItem -Recurse cmdlet into the Remove-Item cmdlet, as described in Example 4 in this topic.
<...>

So its better at least.. I’m happy.

Things used to be so much easier in 1993 Microsoft released MS-DOS 6.0.. Those were the times, a new command called deltree.exe were released and all lived happily ever after. That might have been true, Microsoft have removed deltree.exe from Windows after migrating the function into the del command.

C:\Users\virot>del /?
Deletes one or more files.

DEL [/P] [/F] [/S] [/Q] [/A[[:]attributes]] names
ERASE [/P] [/F] [/S] [/Q] [/A[[:]attributes]] names

  names         Specifies a list of one or more files or directories.
                Wildcards may be used to delete multiple files. If a
                directory is specified, all files within the directory
                will be deleted.

  /P            Prompts for confirmation before deleting each file.
  /F            Force deleting of read-only files.
  /S            Delete specified files from all subdirectories.
  /Q            Quiet mode, do not ask if ok to delete on global wildcard
  /A            Selects files to delete based on attributes
  attributes    R  Read-only files            S  System files
                H  Hidden files               A  Files ready for archiving
                I  Not content indexed Files  L  Reparse Points
                -  Prefix meaning not

If Command Extensions are enabled DEL and ERASE change as follows:

The display semantics of the /S switch are reversed in that it shows
you only the files that are deleted, not the ones it could not find.

C:\Users\virot>

So remember if cant be sure of which Windows your powershell will be running you cant depend on Remove-Item -recurse