SQL Server Performance

how to create script

Discussion in 'Getting Started' started by jagpalsingh4, Mar 6, 2008.

  1. jagpalsingh4 New Member

    Hello.,Delete some files from a folder that are 5 days old.
    This folder will contain log and backup files that re generated every day. We need to keep only say 5 days and delete all other.
    You can create a dummy folder and copy some files into it. Try to write a script to find out all files older than 5 days and then delete them. Create a log file that will show the deleted files with the date stamp.will u plz tell me how can we create this script .
    jagpal singh
  2. ranjitjain New Member

    Do you want to create a SQL script to achieve this, or you can even create SSIS package for this.
    Because through SSIS you can create script task which is a .net script task and you can very easily access filesystemobject.
    Through SQL procedure, you need to use XP_CMDSHELL which is disabled by default and need to be enabled manually.
  3. jagpalsingh4 New Member

    yes i want to create script for this will u pzl tell give me script for this .
  4. jagblue New Member

    how about creating Job and cerating dosbatch file to delete all the logs and backup files in fivedays
  5. jagpalsingh4 New Member

    thats fine with job but will u plz make a script for this .
  6. jagblue New Member

  7. jagpalsingh4 New Member

    plz check its right or wrong
    jagpal singh
  8. jagblue New Member

    how you running this script
    it's working fine for me
  9. jagpalsingh4 New Member

    What i want is in any specidied directory we wanna check the files old that 3 days and list them.

Share This Page