Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 get list of all files on hard drive

Author  Topic 

pithhelmet
Posting Yak Master

183 Posts

Posted - 2007-11-19 : 16:23:44
Hi everyone -

I need to get a list of all files in a directory and put the list into a database table.

Currently I am using a DOS command (dir) that executes from within the stored procedure via a xp_cmdshell command

This works fine for the smaller number of items in the directories,
but this one directory has 250k items, and just to do an interactive dos DIR command takes a little over 5 minutes to display all the filenames.

Does anyone have any other ideas on how to get the actual filenames on the hard drive?

thanks
tony

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2007-11-19 : 16:25:54
That is how you would do it inside T-SQL.

You should reconsider displaying 250,000 items though. No human can process that amount of data very quickly without a program.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/
Go to Top of Page
   

- Advertisement -