Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

inserting a file list into SQL tables

Status
Not open for further replies.

jaylou

Programmer
Feb 17, 2005
70
US
Is there a way to grab all the file names in a directory and populating a SQL table with them? I am trying to create 2 different jobs:
1) I want to get a list of all my backup files in my directory and move all
files over one week old to an archive folder.
2) I want to grab zip files that are over 3GIG and move them off to a
different folder as well.

I need a way to grab the files by name and also by size.
Is this possible?
TIA,
Joe
 
Hi,
You will have to do a DTS package with in it an ActiveXscript with the file system object.
Part of the code:



Set objXMLDOM = CreateObject("MSXML2.DOMDocument.3.0")
objXMLDOM.async = False
objXMLDOM.validateOnParse = False
'...........................................................................
' Open file
'............................................................................

Dim objFSO, objFile, objFolder
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder("D:\Data\LOGI\SendLogi\")


Set objADOCnn = CreateObject("ADODB.Connection")
Set objADORS = CreateObject("ADODB.Recordset")

objADOCnn.Open " Provider=sqloledb; Data Source= XXX; Initial Catalog= BBB; Integrated Security=SSPI"


objADORS.Open "SELECT * FROM tblResponses", objADOCnn, adOpenKeyset, adLockOptimistic

For Each objFile in objFolder.Files

strFile=objFile.Name







Jean-Paul
Montreal
To send me E-Mail, remove “USELESSCODE”.
jp@USELESSCODEsolutionsvba.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top