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.
5 minutes of scripting saved my 20 minutes of handwork and then I was able to write this entry.
#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