I want to remove hundreds of files that are in many sub-directories, the top level is \\Servername\directoryA But there are many folders within those folder which could have other folders with the actual files. The filename is basically the same with the exception of the suffix. The filename start off like CustomerInv_AAA.doc, CustomerInv_BBB.doc, CustomerInv_CCC.doc.
using xp_cmdshell is the option to go with but how do I get it to delete all files, but using a wildcard?
xp_cmdshell 'Del \\Servername\DirectoryA\CustomerInv*.doc' /S ( /S - to look in the sub directory)