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

Configure hosts File in Android

Is Wharton Business Foundations Specialization Good?

iTunes cannot restore the iPhone because Find My iPhone is on and applications are gone!