i run a Tsql query that move's a file from one computer to another
set @sql='move '+@file1+' '+@file2
EXEC master..xp_cmdshell @sql , NO_OUTPUT
now, i want the query to wait until the file arrive's to its destination and only
if FileExists to continue the next action
is there something like shellwait until the xp_cmdshell finish is job?
It might be possible, but a feat like this is far easier to achieve in PowerShell, SSIS, .NET...pretty much any other programming or scripting language besides CmdShell. This is not to mention that accessing the file system from T-SQL brings with it a ton of baggage when it comes to security and auditing. Is moving this process out of T-SQL an option for you? If so, I would strongly recommend changing the approach and disabling xp_cmdshell on the Instance if at all possible. If you want help implementing this task in any of the technologies I mentioned I'd be happy to assist.
__________________________________________________________________________________________________There are no special teachers of virtue, because virtue is taught by the whole community. --Plato