Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2006
    Posts
    3

    Unanswered: xp_cmdshell to delete files

    can I use xp_cmdshell to delete files older than lets say 30 minutes? can anyone show me what the command will look like?

    Thanks
    Shahab

  2. #2
    Join Date
    Dec 2002
    Location
    Sunny Florida
    Posts
    121
    You may want to look in to something from the Windows resource kit or something that offers a "del" command but with more options. Use that and cmdshell.

    Edit:

    I just looked in the resource kit and there doesn't appear to be a hefty version of del. Is this some sort of log directory? Do you also control the creation of the files you want to get rid of?
    Last edited by DBA-ONE; 07-26-06 at 17:56.

  3. #3
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    You might be able to do this with robocopy.exe. If you can't delete them directly, you could move the selected files to a separate directory and then issue a delete *.* against that directory.
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

  4. #4
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •