Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium



Posted on 2004-10-20
Medium Priority
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?
Question by:wordtool
LVL 15

Expert Comment

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"
LVL 50

Accepted Solution

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

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


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


Author Comment

ID: 12363483

Featured Post

[Webinar] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Question has a verified solution.

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

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…
Ready to get certified? Check out some courses that help you prepare for third-party exams.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.
Suggested Courses

571 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