when i run exec xp_cmdshell 'del "c:\windows\temp\*.*"', got promt for [Y/N]...

  • when i delete all files including subfolders from perticuler folder like following througt SQL Command..

    exec xp_cmdshell 'del "c:\windows\temp\*.*"'

    when i run this command, i got output whcih is below and ask for prompt [Y/N]

    c:\windows\temp\*.*, Are you sure (Y/N)?

    NULL

    SO, how i can delete files from perticular folder including subfolders, is there any way..?

    _____________________________________________________________________________________________________________
    Paresh Prajapati
    ➡ +919924626601
    http://paresh-sqldba.blogspot.com/[/url]
    LinkedIn | Tweet Me | FaceBook | Brijj

  • Add the /Q switch to the del command. It puts delete into silent mode so it won't prompt.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Yes, i can able to delete , Thanks for ur reply..

    _____________________________________________________________________________________________________________
    Paresh Prajapati
    ➡ +919924626601
    http://paresh-sqldba.blogspot.com/[/url]
    LinkedIn | Tweet Me | FaceBook | Brijj

  • I am able to delete all files but not able to delete subfolders,

    is there any option?

    _____________________________________________________________________________________________________________
    Paresh Prajapati
    ➡ +919924626601
    http://paresh-sqldba.blogspot.com/[/url]
    LinkedIn | Tweet Me | FaceBook | Brijj

  • Add /S to the command line as well. Just be careful to run it in the intended directory! I once wiped almost my entire harddrive because I inadvertently ran it from C:

    Regards,

    Jan

    --------------------------------------------------------------------------
    A little knowledge is a dangerous thing (Alexander Pope)
    In order for us to help you as efficiently as possible, please read this before posting (courtesy of Jeff Moden)[/url]

Viewing 5 posts - 1 through 4 (of 4 total)

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