|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
HI ,
I want to run a job schedule using sqlserver agent . The objective is to delete files in a particular folder , say, "c:\myfolder" at a regular interval. The files are video.dat or some other format files. The entry of the same is in a corresponding column in a table in database,eg, Mytable.....columns (filename,createddate,expirydate). The entry of the filename would be deleted by the user but the physical files (video.dat) files which are in operating system would have to be deleted only when there is the "expirydate" is reached . I want to use xp_cmdshell but do not know how to write a procedure for the same to meet my objective . Any help is a great help. Thanks a looooooootttts in advance. |
|
#2
|
|||
|
|||
|
you do not have to use a xp_cmdshell to accomplish this.
If you are a little handy with vbscript you can write a vbscript routine using the FileSystemObject, add this to a DTS package as an ActiveX Script taks and schedule the package. This way you have a lot of control over what files and folders you would like to delete. PHP Code:
This script just deletes the folder with all content and creates a new folder with the same name.
__________________
- Rogier Doekes Last edited by rdoekes : August 1st, 2003 at 11:53 AM. |
![]() |
| Viewing: Dev Articles Community Forums > Databases > Microsoft SQL Server > Xp_cmdshell |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|