File System Connector

File System Connector

File System Origin

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 Creatio Connect.

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

Reading and manipulating a File

The connector itself can not read a file, but vbScript or C# code can be used to read and manipulate files.

Reading a file:

Function ScriptedField
    Dim text
    text = ExtractText("C:\test.txt")
    ScriptedField = text
End Function

Moving a file:

Function ScriptedField
    MoveFile("C:\TestDir1\test.txt","C:\TestDir2\test.txt")
End Function

You can also rename the file with this method.

Processing a huge amount of files

Processing a huge amount of files can cause performance issues. We started with a folder with 40,000 tiny .txt files in it and it ran the first 10,000 or so without problem and then slowed to a crawl. The solution for me was to process a file and then move the file to a new folder. In this way, I could easily process the files in increments of 5000.

MIME Types

When importing files to SugarCRM I found that I had to supply the file's MIME type. To do this, I built an xref of file extensions to MIME types, file_extension_to_mime.ids:

.x3d|application/vnd.hzn-3d-crossword
.3gp|video/3gpp
.3g2|video/3gpp2
.mseq|application/vnd.mseq
.pwn|application/vnd.3m.post-it-notes
.plb|application/vnd.3gpp.pic-bw-large
.psb|application/vnd.3gpp.pic-bw-small
.pvb|application/vnd.3gpp.pic-bw-var
.tcap|application/vnd.3gpp2.tcap
.7z|application/x-7z-compressed
.abw|application/x-abiword
.ace|application/x-ace-compressed
.acc|application/vnd.americandynamics.acc
.acu|application/vnd.acucobol
.atc|application/vnd.acucorp
.adp|audio/adpcm
.aab|application/x-authorware-bin
.aam|application/x-authorware-map
.aas|application/x-authorware-seg
.air|application/vnd.adobe.air-application-installer-package+zip
.swf|application/x-shockwave-flash
.fxp|application/vnd.adobe.fxp
.pdf|application/pdf
.PDF|application/pdf
.ppd|application/vnd.cups-ppd
.dir|application/x-director
.xdp|application/vnd.adobe.xdp+xml
.xfdf|application/vnd.adobe.xfdf
.aac|audio/x-aac
.ahead|application/vnd.ahead.space
.azf|application/vnd.airzip.filesecure.azf
.azs|application/vnd.airzip.filesecure.azs
.azw|application/vnd.amazon.ebook
.ami|application/vnd.amiga.ami
N/A|application/andrew-inset
.apk|application/vnd.android.package-archive
.cii|application/vnd.anser-web-certificate-issue-initiation
.fti|application/vnd.anser-web-funds-transfer-initiation
.atx|application/vnd.antix.game-component
.mpkg|application/vnd.apple.installer+xml
.aw|application/applixware
.les|application/vnd.hhe.lesson-player
.swi|application/vnd.aristanetworks.swi
.s|text/x-asm
.atomcat|application/atomcat+xml
.atomsvc|application/atomsvc+xml
.atom, .xml|application/atom+xml
.ac|application/pkix-attr-cert
.aif|audio/x-aiff
.avi|video/x-msvideo
.aep|application/vnd.audiograph
.dxf|image/vnd.dxf
.dwf|model/vnd.dwf
.par|text/plain-bas
.bcpio|application/x-bcpio
.bin|application/octet-stream
.bmp|image/bmp
.torrent|application/x-bittorrent
.cod|application/vnd.rim.cod
.mpm|application/vnd.blueice.multipass
.bmi|application/vnd.bmi
.sh|application/x-sh
.btif|image/prs.btif
.rep|application/vnd.businessobjects
.bz|application/x-bzip
.bz2|application/x-bzip2
.csh|application/x-csh
.c|text/x-c
.cdxml|application/vnd.chemdraw+xml
.css|text/css
.cdx|chemical/x-cdx
.cml|chemical/x-cml
.csml|chemical/x-csml
.cdbcmsg|application/vnd.contact.cmsg
.cla|application/vnd.claymore
.c4g|application/vnd.clonk.c4group
.sub|image/vnd.dvb.subtitle
.cdmia|application/cdmi-capability
.cdmic|application/cdmi-container
.cdmid|application/cdmi-domain
.cdmio|application/cdmi-object
.cdmiq|application/cdmi-queue
.c11amc|application/vnd.cluetrust.cartomobile-config
.c11amz|application/vnd.cluetrust.cartomobile-config-pkg
.ras|image/x-cmu-raster
.dae|model/vnd.collada+xml
.csv|text/csv
.CSV|text/csv
.cpt|application/mac-compactpro
.wmlc|application/vnd.wap.wmlc
.cgm|image/cgm
.ice|x-conference/x-cooltalk
.cmx|image/x-cmx
.xar|application/vnd.xara
.cmc|application/vnd.cosmocaller
.cpio|application/x-cpio
.clkx|application/vnd.crick.clicker
.clkk|application/vnd.crick.clicker.keyboard
.clkp|application/vnd.crick.clicker.palette
.clkt|application/vnd.crick.clicker.template
.clkw|application/vnd.crick.clicker.wordbank
.wbs|application/vnd.criticaltools.wbs+xml
.cryptonote|application/vnd.rig.cryptonote
.cif|chemical/x-cif
.cmdf|chemical/x-cmdf
.cu|application/cu-seeme
.cww|application/prs.cww
.curl|text/vnd.curl
.dcurl|text/vnd.curl.dcurl
.mcurl|text/vnd.curl.mcurl
.scurl|text/vnd.curl.scurl
.car|application/vnd.curl.car
.pcurl|application/vnd.curl.pcurl
.cmp|application/vnd.yellowriver-custom-menu
.dssc|application/dssc+der
.xdssc|application/dssc+xml
.deb|application/x-debian-package
.uva|audio/vnd.dece.audio
.uvi|image/vnd.dece.graphic
.uvh|video/vnd.dece.hd
.uvm|video/vnd.dece.mobile
.uvu|video/vnd.uvvu.mp4
.uvp|video/vnd.dece.pd
.uvs|video/vnd.dece.sd
.uvv|video/vnd.dece.video
.dvi|application/x-dvi
.seed|application/vnd.fdsn.seed
.dtb|application/x-dtbook+xml
.res|application/x-dtbresource+xml
.ait|application/vnd.dvb.ait
.svc|application/vnd.dvb.service
.eol|audio/vnd.digital-winds
.djvu|image/vnd.djvu
.dtd|application/xml-dtd
.mlp|application/vnd.dolby.mlp
.wad|application/x-doom
.dpg|application/vnd.dpgraph
.dra|audio/vnd.dra
.dfac|application/vnd.dreamfactory
.dts|audio/vnd.dts
.dtshd|audio/vnd.dts.hd
.dwg|image/vnd.dwg
.geo|application/vnd.dynageo
.es|application/ecmascript
.mag|application/vnd.ecowin.chart
.mmr|image/vnd.fujixerox.edmics-mmr
.rlc|image/vnd.fujixerox.edmics-rlc
.exi|application/exi
.mgz|application/vnd.proteus.magazine
.epub|application/epub+zip
.eml|message/rfc822
.nml|application/vnd.enliven
.xpr|application/vnd.is-xpr
.xif|image/vnd.xiff
.xfdl|application/vnd.xfdl
.emma|application/emma+xml
.ez2|application/vnd.ezpix-album
.ez3|application/vnd.ezpix-package
.fst|image/vnd.fst
.fvt|video/vnd.fvt
.fbs|image/vnd.fastbidsheet
.fe_launch|application/vnd.denovo.fcselayout-link
.f4v|video/x-f4v
.flv|video/x-flv
.fpx|image/vnd.fpx
.npx|image/vnd.net-fpx
.flx|text/vnd.fmi.flexstor
.fli|video/x-fli
.ftc|application/vnd.fluxtime.clip
.fdf|application/vnd.fdf
.f|text/
    • Related Articles

    • Download File

      External Assemblies To download a file in a C# scripted function, you must first go to the .NET Global section (after you choose to create a global script as found HERE), and in the External Assemblies box, enter the ...
    • Interact with the local file system

      Read files from a folder Function ScriptedVariable Dim fso, folder, files, sFolder, res Set fso = CreateObject("Scripting.FileSystemObject") sFolder = "C:\Results" Set folder = fso.GetFolder(sFolder) Set files = folder.Files For each folderIdx In ...
    • CSV Connector

      Additional Documentation This Connector is based on the CSV ADO.NET Provider by CData. For additional help, including Connection String parameters, please see: https://cdn.cdata.com/help/RVG/ado/ CSV Via Upload (in Cloud Designer) When you upload a ...
    • Upload a file to FTP or sFTP

      To upload a file in a C# scripted function, you must first go to the .NET Global section, and in the External Assemblies box, enter the following: System.dll void CSharpProcedure() { var client = new System.Net.WebClient(); string dt = ...
    • Exchange Connector

      Additional Documentation This Connector is based on the Microsoft Exchange ADO.NET Provider by CData. For additional help, including Connection String parameters, please see: https://cdn.cdata.com/help/CEG/ado/ Overview The "Exchange (NEW)" connector ...