Link to home
Start Free TrialLog in
Avatar of LFMSupport
LFMSupport

asked on

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.
Avatar of adathelad
adathelad
Flag of United Kingdom of Great Britain and Northern Ireland image

AFAIK, there isn't one - I would be surprised if I was proved wrong.
Avatar of nmcdermaid
nmcdermaid

xp_cmdshell 'DIR /B C:\yourfolder'

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

ASKER CERTIFIED SOLUTION
Avatar of nmcdermaid
nmcdermaid

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
>> I would be surprised if I was proved wrong. <<
Famous last words :)
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.
Avatar of LFMSupport

ASKER

Thanks nmcdermaid!