Alex
asked on
Remove files with specific extension from folder
Good morning all,
OK so
There is a process our machines follow when they boot up, I need to remove an array of file types, thus I have the following script
Doesn't work, nor can any amount of googling help :(
Could someone give me a hit in the right direction?
Thank you very much
Alex
OK so
There is a process our machines follow when they boot up, I need to remove an array of file types, thus I have the following script
$Files ='*.pdf','*.doc','*.dot','*.docx','*.docm','*.dotx','*.dotm','*.docb','*.xls','*.xlt','*.xlm','*.xltx','*.xlsm','*.xlsb','*.xla','*.pptx','*.pptm','*.potx','*.potm','*.ppsx','*.ppsm'
Remove-Item "c:\users\$env:UserName\appdata\roaming\Noname"
Get-ChildItem -Path 'c:\users\$env:UserName\appdata\roaming\Noname' $Files | foreach { Remove-Item -Path $_.FullName }
Doesn't work, nor can any amount of googling help :(
Could someone give me a hit in the right direction?
Thank you very much
Alex
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER