The Local Files
synchronization service simulates CSPro's file-based synchronization services,
Dropbox and
FTP. This service uses files stored on a local machine rather than accessing the files over the Internet. It is useful for:
- Synchronizing with Dropbox files when the client software is installed on a Windows machine.
- Synchronizing with an FTP server hosted on a local machine.
- Testing synchronization operations.
Synchronizing with Local Files is particularly helpful when working with large quantities of data that would take a long time to transfer via requests over the Internet (to Dropbox or to an FTP server).
The resource of a Local Files
connection string is the directory where the synchronization files are located. If can be specified as an absolute path specified as a
file URI, or simply as a path, in which case it will be evaluated relative to the running application.
These are options that can be specified in the connection string. Note that values must be
properly encoded based on the way that the connection string is defined (as a string, as a
JSON object, or as a
CSPro URI). The default behavior is marked with ⁺⁺⁺.
| Property Name and Values | Description |
| |
| "createDirectory" | Determines whether the Local Files directory will be created if it does not exist. |
false ⁺⁺⁺ | An error occurs if the directory does not exist. |
true | The directory is created if necessary. |
The following are examples of how to create connections to Local Files:
// -------
// connect to the Dropbox directory mapped to:
// C:\surveys\dropbox
// -------
// shown using a file URI
syncconnect("file:///C:/surveys/dropbox");
// shown using an absolute path
syncconnect(@"C:\surveys\dropbox");
// -------
// connect to the FTP server hosted locally at:
// C:\surveys\ftp-server
// -------
// shown using a file URI
syncconnect("file:///C:/surveys/ftp-server");
// shown using an absolute path
syncconnect(@"C:\surveys\ftp-server");
// -------
// connect to a directory for testing sync operations,
// creating the directory if necessary
// -------
// shown using a path evaluated relative to the running application
syncconnect("Sync-Tests|createDirectory=true");
If connecting to a Dropbox directory, you can use the resource
"Dropbox" with the property
"useLocal" to have CSPro automatically identify the Dropbox directory. Using
that process might result in a connection like:
// connect to the Dropbox directory using the client software
syncconnect("Dropbox|useLocal=true");
Once CSPro connects to a file-based synchronization service, it looks for or creates a directory named CSPro in the root directory, using it for the results of synchronization operations. CSPro uses the following directories: