File System

From Starfish ETL
Revision as of 17:03, 29 May 2015 by Jkuehlthau (talk | contribs)
Jump to navigation Jump to search

The File System Connector reads all files from a folder specified in the Directory field. The Username and Password fields are not used. Filter can be used to filter for certain file names/extensions. To search for all files with an extension of "txt, use the filter "*.txt". To search for all files with "Work" anywhere in the filename, use the filter "*Work*"

The Connector returns standard data in the first 12 fields returned:

  • CreationTime
  • FullDirectoryName
  • DirectoryRelative
  • DirectoryName
  • Extension
  • FullName
  • IsReadOnly
  • LastAccessTime
  • LastWriteTime
  • Length
  • Name
  • LastWriteTime

The Connector returns all information available for the File in json format in the ExtendedProperties field. Rather than add a column for each potential property, we went with a more dynamic method of using one column called “ExtenededProperties” and formatted the data as JSON.

It’s very easy to parse this and then pull out the data you need in Starfish.

First, create a Before Each Row VBScript Operation which loads the chunk of JSON into the parser:

Sub VBScriptProcedure
    ParseJSON("@@ORG:ExtendedProperties@@")
End Sub

Then on your field, pull out the value you want by name..

Function ScriptedField   
    ScriptedField=GetJSON("Authors")
End Function
Function ScriptedField   
    ScriptedField=GetJSON("Title")
End Function

etc..
If a value doesn’t exist for a particular file, it’ll just return “”.