if ( $args['clear_working'
] && ( // Destination does not exist or has no contents.
!
$wp_filesystem->
exists( $remote_destination ) ||
empty( $wp_filesystem->
dirlist( $remote_destination ) ) ) ) { $result =
move_dir( $source,
$remote_destination, true
);
} else { // Create destination if needed.
if ( !
$wp_filesystem->
exists( $remote_destination ) ) { if ( !
$wp_filesystem->
mkdir( $remote_destination, FS_CHMOD_DIR
) ) { return new WP_Error( 'mkdir_failed_destination',
$this->strings
['mkdir_failed'
],
$remote_destination );
} } $result =
copy_dir( $source,
$remote_destination );
} // Clear the working directory?