Solved

xp_commandshell

Posted on 2004-10-20
3
1,086 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
Comment Utility
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
Comment Utility
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
Comment Utility
Thanks!
0

Featured Post

Get up to 2TB FREE CLOUD per backup license!

An exclusive Black Friday offer just for Expert Exchange audience! Buy any of our top-rated backup solutions & get up to 2TB free cloud per system! Perform local & cloud backup in the same step, and restore instantly—anytime, anywhere. Grab this deal now before it disappears!

Join & Write a Comment

Suggested Solutions

Nowadays, some of developer are too much worried about data. Who is using data, who is updating it etc. etc. Because, data is more costlier in term of money and information. So security of data is focusing concern in days. Lets' understand the Au…
JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.

772 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now