XP_FILEEXIST Help !!! | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive


Hi,<br /><br />I have been trying to use XP_FILEEXIST to determine if a directory exists. I know I can run it against a file i.e (exec xp_fileexist ‘c:autoexec.bat’) but I noticed that if I run it against a directory (c:dba) then there are 3 values returned :<br /><br />File Exists<br />File is a directory<br />Parent Directory Exists<br /><br />Is there anyway to output values of "file is a directory" or "Parent Direcory Exists" ?<br /><br />Thanks in advance.<br /><br />[<img src=’/community/emoticons/emotion-1.gif’ alt=’:)‘ />]
As it is undocumented SP you may not get required information, as it referred by MS it can be changed at any time. To my concern I haven’t found the way out to get the details. Satya SKJ
This posting is provided “AS IS” with no rights for the sake of knowledge sharing.
You can handle this kind of work in your presentation layer with filesystem object
Madhivanan Failing to plan is Planning to fail
Hi,<br />it returns three values always when u execute this sp ,<br />1) File Exists<br />2) File is a directory<br />3) Parent Directory Exists<br /><br /><b>parent directory exists has always values eqals to 1 because it always have a parent <br />directory %root%</b><br /><br />If file exists it will return 1 for file exists<br />and<br />if file is directory then it returns 1 for file is a directory<br /><br /><br />HTH<br />Regards.[<img src=’/community/emoticons/emotion-1.gif’ alt=’:)‘ />]<br /><br /><br /><br /><br /><br /><br />hsGoswami<br />[email protected]<br />"Humans don’t have Caliber to PASS TIME , Time it self Pass or Fail Humans" – by Hemant Goswami<br />
Why do you need to determine this?
As Satya said, it is undocumented. And usually you should avoid such features in production code. If you describe what you will use this for, maybe we can find a workaround. —
Frank Kalis
Microsoft SQL Server MVP
Ich unterstütze PASS Deutschland e.V. http://www.sqlpass.de)