loops - Delete specific folders in many folders and subfolders -


so i've noticed windows creates hidden folders called "blabla.jpg.files" if have enabled thumbnail view in picture folder. sync picture folder phone , nas , remove hidden folders there powershell.

since picture folder has subfolders have subfolders , on, create little loop.

the script should scan in subfolders of 1 folder hidden folders name "*.files" , remove them.

can me one.

you don't need create loop get-childitem can search recursively specified item e.g.:

get-childitem <path> -r -attributes h+d *.files | remove-item -r -whatif 

the above command requires features new in powershell v3. if list of folders deleted looks correct, remove -whatif delete them.

btw don't see windows creates these folders on system. create hidden file called thumbs.db. perhaps other program creating these hidden folders?


Comments