Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

xp_commandshell

Posted on 2004-10-20
3
Medium Priority
?
1,144 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 80 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

Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

Question has a verified solution.

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

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
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.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

662 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