December 15, 2011 at 1:04 pm
Hi Everyone,
I want to know that in the directory Is file exist or not and I come across following,
EXEC Master.dbo.xp_fileexist 'C:\test.txt'
But what If file is coming in the directory on hourly bases and file name has time stamp on it.
How can I use EXEC Master.dbo.xp_fileexist ?
ex: TEST_DMMDDYY_THHMMSS.txt
Thanks
December 16, 2011 at 2:05 am
You need the actual filename for xp_fileexist, so unless you can get the exact timestamp before checking, its not going to be possible.
I think the way to check for a file listing is using xp_cmdshell.
But that proc is usually locked down by most administrators.
You may be better off writing a CLR routine, as your admin may give permissions for a your specific CLR - but not for xp_cmdshell.
December 16, 2011 at 10:50 pm
Gosh... you don't need a CLR for this.
EXEC xp_DirTree 'C:\',1,1
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply