Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
cplusplus
Aged Yak Warrior
567 Posts |
Posted - 2010-04-10 : 19:50:46
|
| Is it possible to delete file from windows folder, which is on C drive:I have a program to download e_maiils, sometime the program is downloaing the same twice and has two duplicate same files in the folder, but this program puts the id as prefix.Now i can get the list of files which are duplicate via SP, but is there a way i can delete the files from windows folder on C drive?I have thousands of files like these:"C:\tempmailsfolder\UID_345_myprjectfile.doc"Thank you very much for the helpful info. |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
cplusplus
Aged Yak Warrior
567 Posts |
Posted - 2010-04-10 : 19:55:23
|
| Hello Tara,Thanks found the following on net:http://www.kodyaz.com/articles/delete-file-from-sql-server-xp-cmdshell-ole-automation-procedures.aspxMicrosoft now enables SQL Server administrators to enable or disable the xp_cmdshell extenden procedure and releases the SQL Server products with xp_cmdshell is disabled fby default. So if you think you are capable of taking the security risks and prevent those risks you can enable xp_cmdshell by using the sp_configure stored procedure. Enable xp_cmdshell using sp_configureexec sp_configuregoexec sp_configure 'xp_cmdshell', 1-- Configuration option 'xp_cmdshell' changed from 0 to 1. Run the RECONFIGURE statement to install.goreconfigurego********xp_cmdshell 'del c:\delete-me-file.txt' |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
jeffw8713
Aged Yak Warrior
819 Posts |
Posted - 2010-04-11 : 01:45:02
|
| If you don't want to enable xp_cmdshell - you can use an Agent Job and run using VBScript or operating system commands. |
 |
|
|
|
|
|