private Boolean synchronizeSingleFileInternal(final ImmutablePair<ContentStorage.FileInformation, String> sourceFile, final File targetRootDir,
                                                  final Set<String> targetSyncPropsToUpdate, final Map<String, Properties> targetSyncProps) {
        final String dirPath = getParentPath(sourceFile.right);
        Properties dirProps = targetSyncProps.get(dirPath);
        if (dirProps == null) {
            dirProps = new Properties();
            targetSyncProps.put(dirPath, dirProps);
        }
        final File targetFile = new File(targetRootDir, sourceFile.right);
        final boolean needsSync = !targetFile.exists() || !getFileSyncToken(sourceFile.left).equals(dirProps.getProperty(sourceFile.left.name));

        if (needsSync) {
            if (targetFile.exists() && !targetFile.delete()) {
                return null;
            }
            final Uri targetUri = ContentStorage.get().copy(sourceFile.left.uri, Folder.fromFile(targetFile.getParentFile()), FileNameCreator.forName(targetFile.getName()), false);
            if (targetUri == null) {
                return null;
            }
            dirProps.setProperty(sourceFile.left.name, getFileSyncToken(sourceFile.left));
            targetSyncPropsToUpdate.add(dirPath);
        }
        return needsSync;
    }
returns null in case of failre, true if file needed copy (and was copied), false if file didn't need copy)
main/src/main/java/cgeo/geocaching/storage/FolderUtils.java