# Class DirectorySync

DirectorySync upload class, in charge of creating, replacing and delete data objects on the API. The goal of this execution is to sync local directories with remote CloudFiles containers so that they are consistent.

Namespace: OpenCloud\ObjectStore\Upload
Package: OpenCloud\ObjectStore\Upload
Located at OpenCloud/ObjectStore/Upload/DirectorySync.php

Methods summary
`public static `OpenCloud\ObjectStore\Upload\DirectorySync`` | # `factory( mixed $path, `OpenCloud\ObjectStore\Resource\Container` $container )` Basic factory method to instantiate a new DirectorySync object with all the appropriate properties. Basic factory method to instantiate a new DirectorySync object with all the appropriate properties. #### Parameters $path `mixed` $path The local path $container ``OpenCloud\ObjectStore\Resource\Container`` $container The container you're syncing #### Returns ``OpenCloud\ObjectStore\Upload\DirectorySync``
`public` | # `setBasePath( mixed $path )` #### Parameters $path `mixed` $path #### Throws ``OpenCloud\Common\Exceptions\InvalidArgumentError``
`public` | # `setRemoteFiles( `OpenCloud\Common\Collection\ResourceIterator` $remoteFiles )` #### Parameters $remoteFiles ``OpenCloud\Common\Collection\ResourceIterator`` $remoteFiles
`public` | # `setContainer( `OpenCloud\ObjectStore\Resource\Container` $container )` #### Parameters $container ``OpenCloud\ObjectStore\Resource\Container`` $container
`public` | # `execute( )` Execute the sync process. This will collect all the remote files from the API and do a comparison. There are four scenarios that need to be dealt with: Execute the sync process. This will collect all the remote files from the API and do a comparison. There are four scenarios that need to be dealt with: Exists locally, exists remotely (identical checksum) = no action Exists locally, exists remotely (diff checksum) = local overwrites remote Exists locally, not exists remotely = local is written to remote Not exists locally, exists remotely = remote file is deleted