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 iCloud Drive or iCloud Photos to kDrive Infomaniak using rclone.
✘ UNAVAILABLE with
kSuite free / kSuite Standard
my kSuite / my kSuite+ (ik.me, etik.com, ikmail.com)
Introduction
- This method is intended for advanced users who want to transfer data from iCloud to kDrive without manually copying files one by one.
- rclone allows you to configure an iCloud Drive or iCloud Photos source, and then a kDrive destination via WebDAV.
- Accessing iCloud with rclone requires the usual Apple ID password and two-factor Apple authentication. Apple application passwords are not accepted for this configuration.
- iCloud authentication may need to be renewed periodically with
rclone reconnectorrclone config. - The
rclone copycommand copies files to kDrive without deleting them from the source iCloud.
1. Install rclone
rclone can be installed via the command line. On macOS, Linux, or BSD, open the Terminal application and run the following command:
sudo -v ; curl https://rclone.org/install.sh | sudo bashRefer to the official rclone installation guide if necessary, especially for Windows or for a manual installation.
Once the installation is complete, verify that rclone responds correctly:
rclone version
2. Configure the iCloud source in rclone
In Terminal, start the rclone configuration:
rclone config- Choose
nto create a new remote drive. Give this source an explicit name, for example:
iCloudDrive- Choose the storage type
iclouddrive. - To import documents stored in iCloud Drive, keep the default service
drive. - To import items from iCloud Photos, choose the
photosservice or create a second dedicated remote drive, for exampleiCloudPhotos. - Enter your Apple ID, which is usually an email address.
- Choose to enter your own password, then enter your usual Apple ID password.
- Answer
nto advanced configuration, unless you have a specific need. - Validate the connection from your trusted Apple device, then enter the two-factor authentication code when rclone asks for it.
- When the summary is correct, answer
yto save the configuration.
Verify that the iCloud source is accessible:
rclone lsd iCloudDrive:If you have configured a source dedicated to iCloud Photos, verify it as well:
rclone lsd iCloudPhotos:
3. Configure the kDrive destination in rclone
kDrive must be configured in rclone as a WebDAV storage.
Rerun the configuration if you are no longer in the rclone menu:
rclone config- Choose
nto create a new remote drive. Give the destination an explicit name, for example:
kDrive- Choose the storage type
webdav. - For the URL, enter the direct WebDAV access to your kDrive:
https://ID_KDRIVE.connect.kdrive.infomaniak.com/- Replace
ID_KDRIVEwith your kDrive ID; refer to this other guide if needed.
- For the WebDAV provider (
vendor), chooseother. - For the user (
user), enter the email address used to log in to your Infomaniak user account. - For the password, enter:
- an application password if two-factor authentication is enabled on your Infomaniak account;
- the password for your Infomaniak user account if two-factor authentication is not enabled.
- Leave the
bearer_tokenfield blank.
- Answer
nto the advanced configuration prompt, unless you have a specific need.
[kDrive]
type = webdav
url = https://ID_KDRIVE.connect.kdrive.infomaniak.com/
vendor = other
user = user@example.com
pass = PASSWORD_STORED_BY_RCLONE- When the summary is correct, answer
yto save the configuration.
The resulting configuration will look like this in the rclone configuration file:
rclone lsd kDrive:
The password displayed in the rclone configuration file is not stored in plain text when the configuration is created using rclone config. If you modify this file manually, generate the value for the pass field using the rclone obscure command.
Verify that the kDrive destination is accessible:
4. Copy data from iCloud to kDrive
rclone lsd iCloudDrive:It is recommended to perform a test without the actual transfer using --dry-run:
rclone copy iCloudDrive: kDrive:iCloudDrive --dry-run --progressIf the result is correct, start the copy:
rclone copy iCloudDrive: kDrive:iCloudDrive --progress --transfers 4 --checkers 8 --retries 5 --low-level-retries 10 --log-level INFO --log-file "$HOME/Desktop/rclone-kdrive-import.log"This command copies the folders, subfolders, and files from the source iCloudDrive: to the iCloudDrive folder in your kDrive.
In case of a connection or computer interruption, rerun the same command. rclone will resume the comparison and avoid copying files that are already present when their size and available information match.
To verify the consistency of the copied volume, you can compare the source and destination by size:
rclone check iCloudDrive: kDrive:iCloudDrive --size-only --one-way --progress
Copying iCloud Photos
If you have configured a source dedicated to iCloud Photos, first list the available libraries and folders:
rclone lsd iCloudPhotos:Then, adapt the source path according to the tree structure displayed by rclone. Example:
rclone copy iCloudPhotos: kDrive:iCloudPhotos --dry-run --progressThen, start the copy if the test result is correct:
rclone copy iCloudPhotos: kDrive:iCloudPhotos --progress --transfers 4 --checkers 8 --retries 5 --low-level-retries 10 --log-level INFO --log-file "$HOME/Desktop/rclone-kdrive-photos.log"
5. Correct photo dates if necessary
After exporting or copying photos, the system dates of the files may no longer match the original date the photo was taken. If the chronological display is not correct, 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 present on the computer.
To prepare a local folder for correction, copy the photos to a temporary folder on the desktop, for example:
rclone copy iCloudPhotos: "$HOME/Desktop/iCloud-Photos" --progressThen, install ExifTool from https://exiftool.org/index.html, and then run the script below on macOS from the Terminal application.
The script searches for a date in the file's metadata, 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 entirely:
/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."
BASHAfter correction, send the corrected local folder to kDrive:
rclone copy "$HOME/Desktop/iCloud-Photos" kDrive:iCloudPhotos --progress --transfers 4 --checkers 8 --retries 5 --low-level-retries 10
6. Accessing data from kDrive
Once the copy is complete, your data is 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?