Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

xp_cmdshell question 1

Status
Not open for further replies.

equus2

Programmer
Mar 5, 2008
36
US
When I run this from Mgmt Studio:

EXEC master..xp_cmdshell 'DEL C:\mypath\*.master.*'
GO

It gives this message:
Could Not Find C:\mypath\*.master.*

Runs fine from my job...

What is the problem here?

Thanks
 
Actually nevermind --- file wasn't there - duh
 
You can use xp_fileexist to determine if a file exists.

Code:
Declare @FileExists Int
Exec master..xp_fileexist 'C:\YourFileName.ext', @FileExists Out

Select @FileExists

@FileExists = 1 if the file exists. Otherwise it is 0.

-George

"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top