Knowledge base
1000 FAQs, 500 tutorials and instructional videos. Here, there are only solutions!
Import data to kDrive from iCloud
This guide explains how to import data from Apple iCloud Drive or iCloud Photos to kDrive Infomaniak using the rclone-ui graphical application.
Introduction
- Other import guides available:
- Do not change your password until the import is complete !
- The generated trust token has a limited validity period of 30 days, requiring periodic re-authentication, but this does not apply to rclone's "copy" mode.
1. Establish the connection with the iCloud source (Drive or Photos)
Prerequisites
- The “Allow iCloud access to data on the web” option must be enabled in your Apple account settings (Settings > Apple Account > iCloud).
- You must use the usual password for your Apple ID (application-specific passwords are not supported).
- Advanced Data Protection (ADP): if this option is enabled on your account, web access must be authorized to allow the exchange of encrypted session cookies (PCS).
To add your Apple cloud to rclone:
- Download and open the rclone-ui application (❓: help).
- Go to the menu and choose to create a new remote connection for your iCloud source.
- Give your connection an explicit name (e.g.
iCloudDriveoriCloudPhotos). - Select the
iclouddriveprovider from the list. - If multiple services are available, select the service to import (
drivefor documents, orphotosfor the photo library). - Enter your Apple ID (usually your email address).
- Enter your usual Apple ID password.
- Approve the two-factor authentication (2FA) request from your trusted Apple device when rclone prompts you.
- Interactive process requiring you to approve the connection on a trusted device or via an SMS code.
2. Establish the connection with kDrive (the destination)
To add your kDrive to rclone:
- In the rclone-ui window displaying your existing connections, click the add button to create the destination.
- Give your destination location a name (e.g.
kDrive). - Select
Infomaniak kDrivefrom the list. - Enter your kDrive ID kDrive ID (❓: help).
- A browser window will open: log in to your Infomaniak account to access the same kDrive as the one indicated in step 4, and wait for the confirmation message.
3. Copy iCloud data to kDrive
To start copying your data from Apple to Infomaniak:
- From the rclone-ui home page, click Copy.
- Select your source iCloud (
iCloudDriveoriCloudPhotos) and choose to transfer all or part of the folders. - Select your destination
kDriveand choose the destination folder where you want to store your data. - The eye icon allows you to perform a copy simulation (dry-run) and view the virtual result.
- Start the copy process by clicking on the dedicated button. The transfer button allows you to monitor the progress in real time.
4. Correct the dates of the photos if necessary
After exporting or copying photos, the system dates of the files may no longer match the original date the photos were taken. If the chronological display is incorrect, you can correct the dates on a local copy of the files before sending them permanently to kDrive.
Always work on a local copy of the files before running a correction script. The script below does not run directly on a remote rclone source: it processes a folder located on your computer.
Install ExifTool from https://exiftool.org/index.html, then run the script below on macOS from the Terminal application on a local folder containing your photos.
The script searches for a date in the file's metadata, and then in its name. The corrected files are listed in DateFound.txt and the files without a usable date are listed in DateError.txt, on the desktop.
The script to copy and paste:
/bin/bash <<'BASH'
#!/bin/bash
set -u
ROOT="$(osascript -e 'POSIX path of (choose folder with prompt "Select the folder containing the files to update")')" || exit 0
DESKTOP="$HOME/Desktop"
LOG_FOUND="$DESKTOP/DateFound.txt"
LOG_ERROR="$DESKTOP/DateError.txt"
: > "$LOG_FOUND"
: > "$LOG_ERROR"
find_exiftool() {
if command -v exiftool >/dev/null 2>&1; then
command -v exiftool
return 0
fi
if [ -x "/usr/local/bin/exiftool" ]; then
printf '%s\n' "/usr/local/bin/exiftool"
return 0
fi
if [ -x "/opt/homebrew/bin/exiftool" ]; then
printf '%s\n' "/opt/homebrew/bin/exiftool"
return 0
fi
return 1
}
EXIFTOOL="$(find_exiftool)" || {
printf '%s\n' "ExifTool not found. Install it, then run the script again." >> "$LOG_ERROR"
printf '%s\n' "ExifTool not found. Check DateError.txt on the desktop."
exit 1
}
if [ ! -d "$ROOT" ]; then
printf 'Invalid folder: %s\n' "$ROOT" >> "$LOG_ERROR"
printf '%s\n' "Invalid folder. Check DateError.txt on the desktop."
exit 1
fi
get_exif_date() {
"$EXIFTOOL" -s3 -d "%Y:%m:%d %H:%M:%S" -DateTimeOriginal -CreateDate -MediaCreateDate -TrackCreateDate -CreationDate -ModifyDate -- "$1" 2>/dev/null | awk '/^[0-9]{4}:[0-9]{2}:[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}/ { print substr($0, 1, 19); exit }'
}
get_name_date() {
local name
name="$(basename "$1")"
if [[ "$name" =~ ([12][0-9]{3})[-_]?([01][0-9])[-_]?([0-3][0-9])([_\ -]?([0-2][0-9])[-_\.]?([0-5][0-9])[-_\.]?([0-5][0-9]))? ]]; then
local year="${BASH_REMATCH[1]}"
local month="${BASH_REMATCH[2]}"
local day="${BASH_REMATCH[3]}"
local hour="12"
local minute="00"
local second="00"
if [ -n "${BASH_REMATCH[5]:-}" ]; then
hour="${BASH_REMATCH[5]}"
minute="${BASH_REMATCH[6]}"
second="${BASH_REMATCH[7]}"
fi
printf '%s:%s:%s %s:%s:%s\n' "$year" "$month" "$day" "$hour" "$minute" "$second"
return 0
fi
return 1
}
is_valid_date() {
date -j -f "%Y:%m:%d %H:%M:%S" "$1" "+%Y:%m:%d %H:%M:%S" >/dev/null 2>&1
}
to_touch_date() {
printf '%s' "$1" | sed -E 's/^([0-9]{4}):([0-9]{2}):([0-9]{2}) ([0-9]{2}):([0-9]{2}):([0-9]{2})$/\1\2\3\4\5.\6/'
}
write_metadata() {
local file="$1"
local date_value="$2"
"$EXIFTOOL" -overwrite_original "-DateTimeOriginal=$date_value" "-CreateDate=$date_value" "-ModifyDate=$date_value" -- "$file" >/dev/null 2>&1 || true
}
process_file() {
local file="$1"
local date_value=""
local source=""
date_value="$(get_exif_date "$file")"
if [ -n "$date_value" ]; then
source="EXIF"
else
date_value="$(get_name_date "$file")"
if [ -n "$date_value" ]; then
source="file name"
fi
fi
if [ -n "$date_value" ] && is_valid_date "$date_value"; then
local touch_value
touch_value="$(to_touch_date "$date_value")"
if [ "$source" != "EXIF" ]; then
write_metadata "$file" "$date_value"
fi
if touch -t "$touch_value" "$file" 2>/dev/null; then
printf '%s | %s | %s\n' "$source" "$date_value" "$file" >> "$LOG_FOUND"
else
printf 'Unable to update file date: %s\n' "$file" >> "$LOG_ERROR"
fi
else
printf 'No valid date found: %s\n' "$file" >> "$LOG_ERROR"
fi
}
while IFS= read -r -d '' file; do
case "$file" in
*.json|*_original) continue ;;
esac
process_file "$file"
done < <(find "$ROOT" -type f -print0)
printf '%s\n' "Done. Check DateFound.txt and DateError.txt on the desktop."
BASH
5. Accessing data from kDrive
Once the copy is complete, your data will be accessible from the kDrive web app, the kDrive mobile apps, and devices synchronized with the kDrive desktop app.
If you are also using the kDrive desktop app, wait until the local synchronization is complete before moving or renaming the imported folders.
Link to this FAQ: https://faq.infomaniak.com/2515
Has this FAQ been helpful?