I had a requirement to delete directories by wildcard. Unfortunately RMDIR User* will not work in command prompt. I found the answer in PowerShell. The following command delete a bunch of folders by wildcard selection.
The following command deletes all folders starting with "2008*" under C:\program Files\DBapp\Logs.
get-childitem -path 'C:\Program Files\DBapp\Logs' -filter 2008* | remove-item -force -recurse
The follwoing command deletes all folders starting with anand* under \\servername\c$\documents and settings
get-childitem -path '\\servername\c$\documents and settings' -filter anand* | remove-item -force -recurse
If it helps you, I am glad for you.
No comments:
Post a Comment