• This is an old thread, but here is the solution for using a UNC path for anyone searching and finding this:

    exec xp_cmdshell 'PushD "\\UNCPath" &&(forfiles /m FileName*.* /d -180 /c "cmd /c del @FILE") & PopD'

    \\UNCPath is the complete UNC Path of the directory you are searching for

    FileName*.* is the file name you are searching for. Use Search arguments such as *

    -180 is the number of days to keep

    Francis
    -----------------
    SQLRanger.com