FileList

The FileList driver is designed to retrieve a listing of files on a specified path in the local filesystem.

Connection String Parameters:

There are no parameters to set in the connection string.

Query Parameters:

The filelist can be retrieved by a SELECT command in the following form:

SELECT * FROM [path_to_folder] WHERE filename='filemask' AND directory='current|full'
  • Current   List all files in the specified folder
  • Full   List all files in the specified folder and recurse subdirectories

 

Example:

LOAD ASSEMBLY 'TARGIT.FileList.dll'
DATASOURCE [FileList] = DOTNET CONNECTION 'TARGIT.FileList.FileListConnection' ''
IMPORT [csvFileList] = [FileList].{SELECT * FROM [D:\DemoData] WHERE filename='.csv' *AND directory='full'}

 

Example, InMemory project, including While Loop to read all files:

The InMemory project:

Resulting script from InMemory project:

LOAD ASSEMBLY 'TARGIT.FileList.dll' //server
LOAD ASSEMBLY 'TARGIT.Csv.dll' //server
DATASOURCE [FileList] = DOTNET CONNECTION 'TARGIT.FileList.FileListConnection' 'loadasstring=false;'
DATASOURCE [CSV] = DOTNET CONNECTION 'TARGIT.CSV.CsvConnection' 'HasHeaders=true;loadasstring=false;type=local;delimiter=,;encoding=Windows-1252;culture=en-US;detectionrowscount=100;skiplines=0;'
DECLARE @PathName as string
IMPORT [FileList] = [FileList].{SELECT * FROM [C:\Temp\CSVdata\Multiple] WHERE filename='*.txt' AND directory='current'}
WHILE [FileList].EOF=false
SET @PathName = [FileList].[fullpath]
IMPORT [CombinedCSVtable] = [CSV].{SELECT * FROM [@@PathName]}
  MOVENEXT [FileList]
LOOP
SAVE

 

Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.