[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

System Sp to get filename

Posted on 2005-05-05
6
Medium Priority
?
257 Views
Last Modified: 2010-03-19
Hello,

Does anyone know of a Sp which will give me the names of all the files in any given folder?

cheers,
Wilky.
0
Comment
Question by:LFMSupport
  • 3
  • 2
6 Comments
 
LVL 23

Expert Comment

by:adathelad
ID: 13934328
AFAIK, there isn't one - I would be surprised if I was proved wrong.
0
 
LVL 30

Expert Comment

by:nmcdermaid
ID: 13934372
xp_cmdshell 'DIR /B C:\yourfolder'

will return them but you may have to clean the output a little

0
 
LVL 30

Accepted Solution

by:
nmcdermaid earned 375 total points
ID: 13934381
If you want to save them to a table:

INSERT INTO YourTable
EXEC xp_cmdshell 'DIR /B C:\yourfolder'


0
NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

 
LVL 23

Expert Comment

by:adathelad
ID: 13934403
>> I would be surprised if I was proved wrong. <<
Famous last words :)
0
 
LVL 30

Expert Comment

by:nmcdermaid
ID: 13934407
DIR /? gives you the full list of switches for the DIR commmand.

So you can also use

DIR /A-D /B C:\yourfolder

to exclude folders from the list.
0
 
LVL 1

Author Comment

by:LFMSupport
ID: 13934481
Thanks nmcdermaid!
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
This month, Experts Exchange sat down with resident SQL expert, Jim Horn, for an in-depth look into the makings of a successful career in SQL.
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.
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

865 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