- Moderator
- #1
I have a server with 30,000+ files that I need to be able to quickly search through.
So I figured I'd just write a stored procedure to get the list of files (and their sub-directories)... however I've run into a small snag.
I have an index, a field called FilePath and one called FileName. The FilePath should be the complete path to the file (i.e. "\\server\share\filename.pdf") and the Filename should be just "filename.pdf"
I figured out I can do:
... which loads up the filepath. Is there a way to (at the same time) load the filename into the other field as well?
(I suppose in a pinch, a stored procedure that then parses the filename off the end and updates the records would be OK as well)...
TIA!
Just my 2¢
"What the captain doesn't realize is that we've secretly replaced his Dilithium Crystals with new Folger's Crystals."
--Greg
So I figured I'd just write a stored procedure to get the list of files (and their sub-directories)... however I've run into a small snag.
I have an index, a field called FilePath and one called FileName. The FilePath should be the complete path to the file (i.e. "\\server\share\filename.pdf") and the Filename should be just "filename.pdf"
I figured out I can do:
Code:
INSERT INTO tblFileList (FilePath)
EXEC xp_cmdshell 'dir \\server\share\ /S /B'
... which loads up the filepath. Is there a way to (at the same time) load the filename into the other field as well?
(I suppose in a pinch, a stored procedure that then parses the filename off the end and updates the records would be OK as well)...
TIA!
Just my 2¢
"What the captain doesn't realize is that we've secretly replaced his Dilithium Crystals with new Folger's Crystals."
--Greg