How to Delete Inside of Sub Folders / Directories?

Today I write a very simple Powershell script in order to delete the contents of the sub directories of a directory.

#Parent directory that you will delete the contents of its sub directories
$dir = 'c:\Users\sarp\findthefashion\'

#Foreach sub directory delete all the contents.
Get-ChildItem $dir | ForEach-Object{
$dirToDel = ($dir + $_.name + '\*')
Remove-Item $dirToDel -Recurse
}

5 minutes of scripting saved my 20 minutes of handwork and then I was able to write this entry.

Comments

Popular posts from this blog

Space Character Problem on IE 6, 7, and 8

Does Netflix work on iOS 5 Beta 4?

AWS encryption chart (SSE-S3 vs SSE-KMS vs SSE-C)