Master.dbo.xp_fileexist in sql
-
Hi, I have a stored proc, which converts a pdf to tiff files. Now, I need to rename these tiff files. The main file name is maintained but the last part of the file name changes to xxx00001.tif - xxx is my file name. How can I check if the main part of the file exists, just xxx part so I can rename it? When I use the fileexist, it looks for the entire filename and hence not finding the file. any help is appreciated.
-
Hi, I have a stored proc, which converts a pdf to tiff files. Now, I need to rename these tiff files. The main file name is maintained but the last part of the file name changes to xxx00001.tif - xxx is my file name. How can I check if the main part of the file exists, just xxx part so I can rename it? When I use the fileexist, it looks for the entire filename and hence not finding the file. any help is appreciated.
vanikanc wrote:
How can I check if the main part of the file exists, just xxx part so I can rename it? When I use the fileexist, it looks for the entire filename and hence not finding the file.
Get the directory contents by using
[xp_cmdshell](http://msdn.microsoft.com/en-us/library/aa175921%28v=sql.80%29.aspx)[[^](http://msdn.microsoft.com/en-us/library/aa175921%28v=sql.80%29.aspx "New Window")]
, and check whether there's a recently created file that meets the criteria.Bastard Programmer from Hell :suss: