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 |
gangadhara.ms
Aged Yak Warrior
549 Posts |
Posted - 2013-01-28 : 02:37:11
|
Hi,I am using the below command to download the file from FTP. But i want to ensure if there is no files exist we need to alert a TEAM saying its not there.How can we achieve this ??SET @cmd = 'del E:\ARK\AT\cmds.txt /Q'EXEC master..xp_cmdshell @cmdSET @cmd = 'echo username_XXX>> E:\ARK\AT\cmds.txt'EXEC master..xp_cmdshell @cmdSET @cmd = 'echo password_YYY >> E:\ARK\AT\cmds.txt'EXEC master..xp_cmdshell @cmdSET @cmd = 'echo lcd E:\ARK\AT >> E:\ARK\AT\cmds.txt'EXEC master..xp_cmdshell @cmdSET @cmd = 'echo cd /A/updates >> E:\ARK\AT\cmds.txt'EXEC master..xp_cmdshell @cmdSET @cmd = 'echo mget *' + dbo.AtDate() +'.* >> E:\ARK\AT\cmds.txt'EXEC master..xp_cmdshell @cmdSET @cmd = 'echo quit >> E:\ARK\AT\cmds.txt'EXEC master..xp_cmdshell @cmdSET @cmd = 'ftp -i -s:E:\ARK\AT\cmds.txt ftp.XXX.com'EXEC master..xp_cmdshell @cmdThanks,Gangadhara MSSQL Developer and DBA |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-01-28 : 03:36:42
|
do a dir on file pattern and take the count and check if its >0 before you do abovewrap the entire code in a batch file------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
gangadhara.ms
Aged Yak Warrior
549 Posts |
Posted - 2013-01-28 : 21:40:22
|
thanks visakh for suggestion could you pls some script to count the files ..i am sorry i am not much versed with ftp commands.Thanks,Gangadhara MSSQL Developer and DBA |
|
|
|
|
|