Dear friends , I have erp (client ) installed all the endusers system ,when they do search in any module screen we are get an error , for that we have 2 folders name structure and temp if we drop this error goes so every time we cannt delete manually so i need a batch file for droping this 2 folder for every 1 hr even user is using that erp or not ... os platform is windows 7 and xp ....so kindly help out in this issue ASAp... plz plz
Depending on the version of SQL Server. You could use an agent job and call a PowerShell script to drop the directories. Or use the old batch script. Old DOS RMDIR drive:path Or PowerShell: Remove-Item "C:\Temp\Fldr" -Force -Recurse
A bit more detail in your question might help us give you a more detailed answer. I have a suspicion that continually deleting these folders may not be the best approach. With that said, if you want to do this from inside a SQL Script you can use xp_cmdshell, but it must be enabled and that can create security issues. If you want to use a batch file, then it could look like rmdir c:\temp /s rmdir c:\temp2 /s The /s tells it to remove the contents of the directory as well as the directory and it works in a fashion similar to deltree. As sqlaj said, a powershell script might work better. As far as making it run every hour, you could set it up as a SQL Agent job on a timer, or you could set it up to use the windows task scheduler. But I would really be cautious about doing it every hour. Even if you decide you do need to repeatedly delete the folders, I would consider just adding the deletion to the program so it happens right when it needs to happen. Even if your ERP program is a 3rd party program, you can have your users call it by running a powershell script that deletes the folders and then opens the program instead of doing it on a timer.