Good Afternoon
All users currently have access to their own folder on the network and have the base folder structure such as this
\\SERVERA\main\test.user\
\\SERVERA\main\john.smith\
\\SERVERA\main\test.user3\
However we need to remove a specific folder from each users directories where it has the word 'old' in there like so;
\\SERVERA\main\test.user\datafolder
\\SERVERA\main\test.user\datafolderold
\\SERVERA\main\test.user\datafolderold2
Therefore running the script will remove the 2 folders with OLD
I hope this explains the principle
Currently i have the following scripts but i am unable to get this to remove the folders as above
$location = '\\servera\main\' foreach($loc in $location){ $users = Get-ChildItem "\\$location\" |select name $users | where{ $_.Name -match [regex]'(old)'} write-host $users }
Any help / advice greatly appreciated
Regards
Barrie