Link to home
Start Free TrialLog in
Avatar of PharmAll
PharmAll

asked on

SQL xp_cmdshell to get file paths

Hi all,

This is the simplest form of xp_cmdshell that I have seen. How would I produce a table that shows the file's paths in their subfolders?

declare @files table (ID int IDENTITY, FileName varchar(100))
insert into @files execute xp_cmdshell 'dir d:\import\ /b'
select * from @files

Thanks!
ASKER CERTIFIED SOLUTION
Avatar of keyu
keyu
Flag of India image

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
Avatar of PharmAll
PharmAll

ASKER

Absolutely brilliant - thank you very much!

And what great article - I will bookmark that one.