[Solved] Delete specific subfolder under unknown folders from anywhere


I created a short powershell solution using this-

$targetName="ss s";
foreach ($file in Get-Childitem "G:\Project\Projects\" )
{
   $fname=$file.name;
   if (Test-Path "G:\Project\Projects\$fname\$targetName\")
        { 
            $shell = new-object -comobject "Shell.Application"
            $item = $shell.Namespace(0).ParseName("G:\Project\Projects\$fname\$targetName")
            $item.InvokeVerb("delete")

        }
}

This powershell script sends that folder to recycle bin after confirmation popup. (this won’t send any file named ‘ss s’)

this seems to be working for batch file script-

set "b=ss s"
for /d %%a in (*) do  IF EXIST "%%a\%b%\*" (rmdir /s "%%a\%b%")

if the targetfolder was named “$ss s” then you have to set variables as "b=/$ss s"

1

solved Delete specific subfolder under unknown folders from anywhere