Solved

xp_commandshell

Posted on 2004-10-20
3
1,130 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 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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

Suggested Solutions

This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.

752 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