Solved

xp_commandshell

Posted on 2004-10-20
3
1,111 Views
Last Modified: 2008-01-09
Using xp_commandshell how do I just get file/folder names without the attributes and the lines without the Drive volume information into a table?
0
Comment
Question by:wordtool
3 Comments
 
LVL 15

Expert Comment

by:mcmonap
ID: 12363322
Hi wordtool,

Use Lowfatspread's code and change the dir to use the parameters "/ad /b", so:

exec master.dbo.xp_cmdshell "dir c:\windows /ad /b"
0
 
LVL 50

Accepted Solution

by:
Lowfatspread earned 20 total points
ID: 12363337
exec master.dbo.xp_cmdshell "Dir C:\ /B"

use the /B "bare" parameter of the DIR command

e.g.

Insert into #temp
 (dataline)
exec master.dbo.xp_cmdshell "Dir C:\ /B"


 
0
 

Author Comment

by:wordtool
ID: 12363483
Thanks!
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

786 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question