Delete Routine

  • 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)

  • I got it to work, I just added a wildcard "*" to the filename.

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply