I am using TFS v2015 to deploy a web application to a remote server. Due to the way our project is structured (as a web site project) the build ends up creating a separate DLL for each .cs. The names of the DLL files are random and change on each deploy. This has resulted in 25,000+ files in the bin folder with names like "App_Web_0bbazvic.dll".
What I would like to do is, before copying files to target machine, delete all files matching the pattern "/bin/app_code_*.dll" from the remote bin directory.
I have considered using the "Machine File Copy" with the option "clean target" enabled, but I don't want to delete the entire directory. I can explain my reasons for this in more detail if requested.
I am also considering the "Power Shell on Target Machine" task. Any suggestions would be appreciated. Also, the remote server is not in the same domain as the build agent.

