File System: Difference between revisions

From Starfish ETL
Jump to navigation Jump to search
No edit summary
No edit summary
Line 15: Line 15:
*LastWriteTime
*LastWriteTime


The Connector returns all information available for the File in json format in the ExtendedProperties field.
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:
<source lang="vbscript">
Sub VBScriptProcedure
                ParseJSON("@@ORG:ExtendedProperties@@")
End Sub
</source>
Then on your field, pull out the value you want by name..
<source lang="vbscript">
Function ScriptedField 
                ScriptedField=GetJSON("Authors")
End Function
</source>
<source lang="vbscript">
Function ScriptedField 
                ScriptedField=GetJSON("Title")
End Function
</source>
etc..
If a value doesn’t exist for a particular file it’ll just return “”.

Revision as of 17:02, 29 May 2015

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 “”.