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)
 SQL Server sp_OAGetProperty iterating files collection

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2004-05-24 : 10:18:14
bronius writes "Using SQL Server stored proc sp_OAGetProperty (or sp_OAMethod), how can I iterate a file directory to manipulate each file one by one? Currently, I've gotten as far as getting the files collection, but I can't seem to get the sp_OAGetProperty to use Files.Item in any subscripting/indexed way.

In order to build a recordset of or at least loop-through a list of files in the dir, I'm trying to basically say Files.Item(1).Name

All FileSystemObject examples use a foreach, which, of course, is not available using sp_OAGetProperty or sp_OAMethod. Also, I suspect it's not possible (?!) to reference without a filename..?

thanks!
-bronius"

aiken
Aged Yak Warrior

525 Posts

Posted - 2004-05-24 : 13:54:16
Depending on what you're actually trying to do with the files, you may be better off with xp_cmdshell; do a dir using it, dump that into a table, then cursor through it or use a query to build a big string to send to xp_cmdshell the second time.

Cheers
-b
Go to Top of Page
   

- Advertisement -