Would like to use powershell to loop through all C:\Users\*
and delete all contents of a subdirectory...
Some users, but not all, use an app that creates cache files at:
C:\Users\UserName\AppData\Local\SomeApplication\CacheFiles
I'm just not sure how to use /*/ to go to all the user dirs and continue if the CacheFiles directory doesn't exist or if it's empty...
Do we need to get all C:\Users\
store it in an array and then pass that plus the rest of the path? Or Can we simply just say for all "Dirs" in C:\Users\*
delete rest of path...?
I don't know if I'm making this harder than it needs to be...this is what I have:
Get-ChildItem -Path C:\Users\*\AppData\Local\SomeApplication\CacheFiles -Include *.* -File -Recurse | foreach { $_.Delete()}