January 31, 2005 at 1:33 pm
Is there a script that can be built to verify the existance of a file, assuming the file's directory is given in a specified field in a user table?
For example:
I have a locator Column in my Media.dbo user table. In that column for every entry I have a directory path (ex: //BCFILEMGR/Mediafiles/BCXP1/test.omf) Can you have SQL verify that the "test.omf" file actually exists at the location given? Assuming the volume indicated is mounted on the server.
Thanks in advance
'hboypro
January 31, 2005 at 1:55 pm
There is an undocumented extended stored procedure that you can use for this. It is xp_fileexist and resides in the master database. Following is a sample execution -
exec master..xp_fileexist 'x:\SQL_Backups\test.BKP'
If the file exists, you will receive a '1' in the File Exists "column" of the output.
Here's a sample of its use in a stored procedure -
EXEC master..xp_fileexist @DestFile, @result output
IF (@result = 0)
BEGIN
-- Steve
January 31, 2005 at 3:24 pm
Great, that's what I needed.
Thanks.
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy