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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Directory list not using xp_cmdshell

Status
Not open for further replies.

djj55

Programmer
Feb 6, 2006
1,761
US
Hello, SQL 2008
Is there a way in T-SQL to get a list of files in a specified folder (similar to dir c:\temp) without using xp_cmdshell?

I am trying to remove the need to use xp_cmdshell from our stored procedures.

Thank you,

djj
The Lord is My Shepard (Psalm 23) - I need someone to lead me!
 
You could create a CLR stored procedure that queries the directory structure. But this has the same security concerns as xp_cmdshell. Are you more concerned with security, or with the need to use an extended stored procedure?

-------++NO CARRIER++-------
 
Thank you philhege. We are concerned about security, however having xp_cmdshell inactive is not a must, just a "it would be nice".

I could also use a .NET wrapper but was hoping MS had come up with a nice undocumented procedure.

Thanks again,

djj
The Lord is My Shepard (Psalm 23) - I need someone to lead me!
 
If anything, they tightened security. Undocumented procedures that have access to the file system are not very secure.

-------++NO CARRIER++-------
 
Yep, I have noticed that.

djj
The Lord is My Shepard (Psalm 23) - I need someone to lead me!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top