• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 262
  • Last Modified:

System Sp to get filename

Hello,

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

cheers,
Wilky.
0
LFMSupport
Asked:
LFMSupport
  • 3
  • 2
1 Solution
 
adatheladCommented:
AFAIK, there isn't one - I would be surprised if I was proved wrong.
0
 
nmcdermaidCommented:
xp_cmdshell 'DIR /B C:\yourfolder'

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

0
 
nmcdermaidCommented:
If you want to save them to a table:

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


0
Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

 
adatheladCommented:
>> I would be surprised if I was proved wrong. <<
Famous last words :)
0
 
nmcdermaidCommented:
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
 
LFMSupportAuthor Commented:
Thanks nmcdermaid!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now