Knowledge base
1000 FAQs, 500 tutorials and explanatory videos. Here, there are only solutions!
This guide explains how to resolve certain Lite Sync macOS errors that may occur with the desktop app kDrive (desktop application on macOS).
Synchronization block 1/10
Check that macOS permissions are enabled for kDrive and the Lite Sync extensions:
- Open the macOS settings:
- Under General, click on Open and extensions:
- Scroll down to the Endpoint Security Extensions :: kDrive LiteSync Extension indication:
- Make sure the permissions are enabled and confirm at the bottom:
Take this opportunity to check the other elements related to kDrive to ensure everything is activated.
Error of type "Unable to start Lite Sync plugin"
To correct an error of type "Unable to start Lite Sync plugin
" which usually occurs when the Lite Sync extension has disappeared or does not have the necessary permissions…
... check for the presence of the extension
From a terminal application (command line interface, CLI) on a macOS device:
% systemextensionsctl list
The result looks like this:
1 extension(s)
--- com.apple.system_extension.endpoint_security
enabled active teamID bundleID (version) name [state]
* * 864VDCS2QY com.infomaniak.drive.desktopclient.LiteSyncExt (3.5.0/1) kDrive LiteSync Extension [activated enabled]
If the command result does not mention "kDrive LiteSync Extension
", the extension is not present:
- Delete the synchronization and add it again.
If the command result does not have the status [activated enabled]
:
- Enable the extension in the System Settings / Privacy & Security.
... check the extension's permissions
In the System Settings / Privacy & Security / Full Disk Access of the macOS device:
... check the extension's operation
From a Terminal:
% ps -ef | grep LiteSyncExt
The result is similar to:
0 7434 1 0 1:02 ?? 0:25.42 /Library/SystemExtensions/6035BDE4-B7D6-477E-A6AB-C2281E3C7752/com.infomaniak.drive.desktopclient.LiteSyncExt.systemextension/Contents/MacOS/com.infomaniak.drive.desktopclient.LiteSyncExt
If the extension does not appear to be working, try the following actions:
- Restart the app.
- Restart the Mac.
- Remove / add the sync.
- Uninstall / reinstall the app.
If that still doesn't work
- Request the kDrive logs (Debug level):
- Check in the Console if there is a blockage report on the date of the last app startup and if so, send them to Infomaniak:
Retrieve the kDrive messages in the Console:
- Quit the app.
- In the Console, select the Mac, filter by
[KD]
, click on Start: - Launch the app.
- Click in the list of messages, select them (Ctrl+A), copy them (Ctrl+C) and send them to Infomaniak.
This guide explains how to copy data within the desktop app kDrive (desktop application on macOS / Windows / Linux) from one kDrive to which your Infomaniak user has access to another kDrive to which the same Infomaniak user has access.
Preamble
- To be a user of multiple Organizations, you must have been added to them and have been granted access to the respective kDrive.
- For example, if the user
abc@domain.xyz
has a kDrive "ABC
" within their Organization "ABC
" and is invited to the Organization "VWX
" which grants them access to the kDrive "VWX
", they will see 2 kDrive on kdrive.infomaniak.com and will be able to send data from one to the other in 1 click.
- For example, if the user
- Even if you are not a user of multiple Organizations, it is also possible to copy data but only by importing the entire kDrive, without being able to choose specific data.
kSuite Configuration
If you are in a kSuite environment (the kDrive app displayed within ksuite.infomaniak.com
, you must ensure that all Organizations are displayed, otherwise you will not be able to switch from one kDrive to another and consequently will not have the function to copy to other kDrives:
Copying data between multiple kDrive
To copy a folder or file to the other kDrive you have access to from the same user account:
- Click here to access the Web app kDrive Infomaniak (online service kdrive.infomaniak.com).
- Check or select the relevant kDrive from the dropdown menu in the left sidebar.
- If necessary, select the other kDrive from which you want to copy files:
- Click on the action menu ⋮ to the right of the folder or file you want to copy to the other kDrive.
- Click on Organize.
- Click on Copy to another kDrive:
- Select the relevant kDrive from the list visible in the same dropdown menu.
- Choose the destination location (knowing that the Shared Folder cannot receive a file or folder at its root but you can create a subfolder using the appropriate icon if the user has the rights).
- Click on the blue button to start the copy:
If you want to import all the data contained on the other kDrive in one go, refer to this other guide and select kDrive at point 6.
This guide explains how to create, save and edit an Office file (text, spreadsheet, presentation...) on the Web app kDrive (online service kdrive.infomaniak.com) and on the mobile app kDrive (application for iOS/Android smartphone or tablet).
Working with the native editor
kDrive natively integrates the applications Docs, Grids, and Points which allow you to create, edit, and collaborate online on documents of type Word .docx
, Excel .xlsx
, and PowerPoint .ppsx
. You can thus work with:
- word processing document
- spreadsheet (worksheet)
- presentation
- notebook
- document draw.io for diagrams, schematics and wireframes
A feature allows you to add a bookmark (shortcut to a favorite passage in your document or the equivalent of a web page anchor) that you can easily share with your contacts. You can also easily notify a user in your Organization directly on the document.
Read the guide on this topic.
Working with Microsoft Office Online
Another editing solution is available to you (depending on the kDrive / kSuite offer activated): the Microsoft Office Online editor.
Read the guide on this topic.
This guide explains how to transfer files from an iPhone to a kDrive Infomaniak.
Prerequisites
Manually send data to kDrive…
... on iOS (iPhone, iPad)
- Select the data you want to share on kDrive.
- Click on the iPhone share icon:
- Choose kDrive from the options offered:
- Select the kDrive and the save location - if this does not suit you, tap on it to change the storage folder:
- Choose another folder or create a new folder:
- Determine the type of folder to create (shared folder with kDrive users or personal & private folder):
- Name the folder, choose the optional shared access, then press the blue button to create the folder:
- Tap on the newly created folder to select it as the location:
- Create a potential subfolder within it or confirm the chosen location using the blue button:
- Press the blue button to start sending your files to kDrive:
- It is possible to follow the progress of the transfer to kDrive:
- Uploading occurs in the background:
Once the files are uploaded, you will find them on all devices connected to kDrive…
- … instantly on the Web app kDrive (online service kdrive.infomaniak.com).
- … after downloading the list of these new files on the devices where the desktop app kDrive (desktop application for macOS / Windows / Linux) is installed.
This guide explains how to edit a PDF file on the Web app kDrive (online service kdrive.infomaniak.com.
COMPATIBILITY my kSuite ✗ | my kSuite+ ✔ ✔= Offer compatible | ✗= Not available |
Introduction
- The Web app kDrive natively integrates an editor that allows you to edit a PDF document online.
- Your files are never analyzed and are exclusively stored in Switzerland.
- Refer to this other guide if you are looking for information on editing other file formats.
Edit a PDF file
To access kDrive and edit the PDF document:
- Click here to access the Web app kDrive Infomaniak (online service kdrive.infomaniak.com).
- Open the relevant PDF document.
- Click on the Edit button at the top of the document to access the file editor:
- The PDF editor allows you to:
- to insert an image into your document, for example a photo:
- to highlight text or any element:
- to add text to the location, size and color of your choice:
- to create a signature and then sign documents (refer to this other guide for more information).
- to insert an image into your document, for example a photo:
- Once finished, save the changes and choose whether to create a copy of the modified document or overwrite the existing file.
Rename a file (PDF or other)
It is possible to rename any file by clicking on the action menu ⋮ located to the right of the concerned item:
You can also open the file and rename it directly from the preview. Example with a PDF file:
This guide details the various assignments and access permissions for files/folders in Infomaniak's kDrive, including restoring the inheritance of rights over the content of folders and subfolders.
Preamble
- Refer to this other guide if you are looking for general information about sharing data on kDrive.
- Refer to this other guide for more specific information about sharing the common folder.
- Refer to this other guide for more general information on user permissions within the Organization if they are part of it.
Types of access rights
A share can be restricted. Choose whether the user…
- … can view:
- View only
- Download
- Add comment
- … can edit:
- Edit file
- Download
- Add comment
- Add and create file/folder
- Delete file/folder
- … can manage (only if sharing is done within the common folder and not in a folder of the personal directory):
- File modification
- Download
- Add comment
- Add and create file/folder
- Delete file/folder
- Share with other users
- Manage user rights
The granted permissions as well as the information about the beneficiaries of the shares are visible on kDrive in the "Who has access" column and the eventual public link activated on a file is indicated by a green icon in this column:
Assigning rights to the content of folders and subfolders
The shared folder does not necessarily mean that all kDrive users have access to it.
Indeed, sharing can be restricted and only part of the directory tree can be shared with one or more users. Example of recursion when applying or removing sharing:
- The first part of the animation shows full access for all users to the entire content of folders and subfolders.
- The second part shows the result if the sharing is removed from the parent folder (the folder at the very top of the hierarchy).
- Users will no longer have access to the content of the folders and subfolders.
Solving an inheritance rights issue
In the case where a parent folder is shared with multiple users, and subsequently, one of these users is removed from the share at one of the child folders (i.e., one of the subfolders of the main folder located higher in the hierarchy), then the day a new share with a collaborator is made at the parent folder level, this share will not be propagated or inherited at the child folders level. This is shown in the animation below:
- A share is granted to an additional user on a parent folder (SEPT24 in the animation).
- The share is recursive on all the data contained in the children folders (assoc in the animation).
- The share is removed from one of these child folders (assoc).
- An additional share is made on the parent folder (SEPT24).
- The child folder does not inherit this share (due to the manual operation at point 2 above).
- The solution is to click on the link present in the sharing window, which informs you that the sharing is not complete, which will restore the correct access rights according to the inheritance of the parent folder:
This guide details some of the operations that can be performed with data stored on kDrive Infomaniak.
Add to favorites / file tracking
Favorites are synchronized between the web app kDrive Infomaniak (online service kdrive.infomaniak.com)…
… and the mobile app (application for iOS/Android smartphone or tablet):
On the kDrive web app
To favorite a file or folder in the Web app kDrive Infomaniak (online service kdrive.infomaniak.com) :
- Click here to access the Web app kDrive Infomaniak (online service kdrive.infomaniak.com).
- Select a file to mark as a favorite and click on the icon ☆:
You can also favorite multiple files using the top menu…
… or click on the action menu ⋮ located to the right of the relevant item:
Unzip an archive
This feature for .zip
files is planned but is not yet available.
This guide explains how to view 3D files on the kDrive web app (online service kdrive.infomaniak.com) and interact with them.
Introduction
- The 3D file object can be viewed with a choice of light or dark background.
- It is possible to zoom in and out, and the 3D view can be recentered with a click.
- The camera can be in orthographic or perspective mode.
- Extensions recognized and theoretically supported by online preview:
3dm
3ds
3mf
amf
bim
brep
dae
fbx
fcstd
glb
ifc
iges
obj
off
ply
step
stp
stl
wrl
- Recognized extensions only:
blend
usd
usda
usdc
usdz
gltf
- Formats that depend on other files cannot be previewed.
- Files with a thumbnail (like
obj
,stl
, etc.) are generally supported by the preview.
Preview 3D files
To access kDrive and interact with the 3D images:
- Click here to access the Web app kDrive Infomaniak (online service kdrive.infomaniak.com).
- Open the relevant image file.
- Manipulate the object directly with the cursor.
- Use the toolbar available below the image:
This guide details how to import your photos from Google Photos (https://photos.google.com/) to kDrive Infomaniak.
1. Export your Google Photos
To retrieve all your photos stored on Google Photos to your computer's hard drive, you must use the Google Takeout service. This allows you to choose which albums to retrieve if you want to proceed in steps:
- Log in to Google Takeout.
- Deselect all products to keep only Google Photos:
- If necessary, deselect the albums you do not want to export:
- Go to the next step at the bottom of the page:
- Configure the export by ZIP archives:
- Click at the bottom on the “Create export” button to start the export.
- Wait (for several hours or even several days) until you receive an email containing the links to the ZIP exports.
- Download and then extract the content onto your computer:
- Clean and merge your different photo folders if necessary.
2. Correct the dates of the exported photos…
During the export, the creation dates of the files are modified and replaced by the export date instead of the original capture date. Therefore, you need to correct the dates using an appropriate script.
Here is a script for advanced users that allows you to restore the correct data to your files based on EXIF information (it is recommended to process batches of 7000-8000 photos max. to avoid a crash):
... on macOS
- Download ExifTool https://exiftool.org/index.html (macOS Package).
- Install the application by allowing it to open first if necessary:
- Open Script Editor (located in your Applications > Utilities folder):
- Click on New document.
- Copy and paste the long script provided below into the Script Editor window.
- Click on Run to start the script, a window opens:
- Select the folder to analyze.
- Let the script run, it will modify the dates or write errors in a file
errors.txt
on the desktop.
The script to copy and paste in full:
-- replace file date with EXIF creation date or date from name after the first dash -
tell application "Finder"
set FolderPath to choose folder with prompt "Select the folder containing the files to update"
my processFolder(FolderPath)
end tell
on processFolder(aFolder)
tell application "Finder"
-- process files:
set fileList to files of aFolder
repeat with eachFile in fileList
-- process a single file
set theFile to eachFile
set AppleScript's text item delimiters to {""}
set fileName to name of eachFile --get the file name
set eachFile to eachFile as string --file path
set hasDate to true --initialize date found flag
try
--get date if available
set photoDate to do shell script "/usr/local/bin/exiftool -DateTimeOriginal " & quoted form of POSIX path of eachFile
if photoDate is "" then set photoDate to do shell script "/usr/local/bin/exiftool -CreationDate " & quoted form of POSIX path of eachFile
if photoDate is "" then set photoDate to do shell script "/usr/local/bin/exiftool -CreateDate " & quoted form of POSIX path of eachFile
if photoDate is "" then
set hasDate to false --check if date was found
end if
on error
set hasDate to false -- error retrieving date
set photoDate to ""
end try
if length of photoDate > 20 then
--format extracted date
set x to (length of photoDate) - 33
set OriginalDate to text -x thru -1 of photoDate
set formattedDate to text 1 thru 5 of OriginalDate
set theYear to formattedDate
set formattedDate to formattedDate & text 7 thru 8 of OriginalDate
set theMonth to text 7 thru 8 of OriginalDate
set formattedDate to formattedDate & text 10 thru 11 of OriginalDate
set theDay to text 10 thru 11 of OriginalDate
set formattedDate to formattedDate & text 13 thru 14 of OriginalDate
set theHour to text 13 thru 14 of OriginalDate
set formattedDate to formattedDate & text 16 thru 17 of OriginalDate
set theMinute to text 16 thru 17 of OriginalDate
set formattedDate to formattedDate & "." & text 19 thru 20 of OriginalDate
set theSecond to text 19 thru 20 of OriginalDate
set newName to theYear & "-" & theMonth & "-" & theDay & " " & theHour & "." & theMinute & "." & theSecond
set testValue to formattedDate as string --check if found date is 000
if testValue is " 000000000000.00" then
set hasDate to false
else
-- set file date to original EXIF date and write to log
do shell script "touch -t " & formattedDate & " " & quoted form of POSIX path of eachFile
set logFile to open for access ((path to desktop folder as text) & "Date Found.txt") as text with write permission
write "Original date found for file: " & OriginalDate & " " & eachFile & return to logFile starting at eof
close access logFile
end if
end if
if hasDate is false then
-- get date from file name after first dash
set nb to ""
set nameDate to ""
set fileName to fileName as string
set savedDelimiters to AppleScript's text item delimiters --save delimiters
set AppleScript's text item delimiters to {"-"} --split on "-"
set nb to offset of "-" in fileName
if nb is not 0 then
set AppleScript's text item delimiters to savedDelimiters --restore delimiters
set nameDate to characters (nb + 1) thru (nb + 8) of fileName as string
set nameDate to nameDate & "1200.00"
set cmd1 to "/usr/local/bin/exiftool -datetimeoriginal=" & nameDate & " " & quoted form of POSIX path of eachFile
set cmd2 to "/usr/local/bin/exiftool -createdate=" & nameDate & " " & quoted form of POSIX path of eachFile
end if
try
-- write date from name to EXIF
do shell script cmd1
do shell script cmd2
do shell script "touch -t " & nameDate & " " & quoted form of POSIX path of eachFile
do shell script "rm " & quoted form of POSIX path of (eachFile & "_original")
on error
-- if date from name is invalid, log the error
set logFile to open for access ((path to desktop folder as text) & "Date Error.txt") as text with write permission
write "No valid date found in file name: " & eachFile & return to logFile starting at eof
close access logFile
end try
end if
end repeat
-- process folders:
set folderList to folders of aFolder
repeat with eachSubfolder in folderList
-- process a subfolder
my processFolder(eachSubfolder)
end repeat
end tell
end processFolder
tell application "Finder"
display dialog "Done! All files processed." buttons {"Close"}
end tell
… on Windows
- Download ExifTool https://exiftool.org/index.html (Windows executable)
- Place it in an accessible folder (for example
C:\ExifTool
). - Rename
exiftool(-k).exe
toexiftool.exe
. - Note its path (for example
C:\ExifTool\exiftool.exe
). - Copy and paste the long script below into a text file, such as Notepad, on your computer.
- Modify the path specified in the file with the one noted in step 4 if necessary.
- Save it with the extension
.ps1
, for exampleUpdateExifDates.ps1
. - Right-click on the
.ps1
file to run it with PowerShell (a command-line interpreter and scripting environment, pre-installed on modern versions of Windows). - Select the folder to analyze.
- Let the script run, it will modify the dates or write errors in a file
DateError.txt
on the desktop.
PowerShell may block scripts. To allow their execution (if necessary), open PowerShell as an administrator and type Set-ExecutionPolicy RemoteSigned
.
The script to copy and paste entirely:
# === Configuration ===
$exifToolPath = "C:\ExifTool\exiftool.exe"
$desktop = [Environment]::GetFolderPath("Desktop")
$logFound = Join-Path $desktop "DateFound.txt"
$logError = Join-Path $desktop "DateError.txt"
# === Folder Selection Dialog ===
$folder = (New-Object -ComObject Shell.Application).BrowseForFolder(0, "Select the folder to process", 0).Self.Path
function Process-Folder {
param ([string]$path)
Get-ChildItem -Path $path -Recurse -File | ForEach-Object {
$file = $_
$filePath = $file.FullName
$fileName = $file.Name
$hasDate = $true
# Try reading EXIF date
$photoDate = & $exifToolPath -DateTimeOriginal "$filePath"
if (-not $photoDate) { $photoDate = & $exifToolPath -CreateDate "$filePath" }
if (-not $photoDate) { $hasDate = $false }
if ($hasDate -and $photoDate -match "\d{4}:\d{2}:\d{2} \d{2}:\d{2}:\d{2}") {
$dateString = $matches[0] -replace "[:]", "", 1, 2 -replace "[:]", "", 1, 1 -replace " ", ""
$formattedDate = $dateString.Substring(0, 12) + "." + $dateString.Substring(12, 2)
try {
$newDate = [datetime]::ParseExact($photoDate.Trim(), "yyyy:MM:dd HH:mm:ss", $null)
[System.IO.File]::SetCreationTime($filePath, $newDate)
[System.IO.File]::SetLastWriteTime($filePath, $newDate)
Add-Content -Path $logFound -Value "EXIF date set for: $fileName → $photoDate"
} catch {
$hasDate = $false
}
}
if (-not $hasDate) {
if ($fileName -match "-(\d{8})") {
$nameDate = $matches[1] + "1200.00"
try {
& $exifToolPath "-datetimeoriginal=$nameDate" "$filePath"
& $exifToolPath "-createdate=$nameDate" "$filePath"
$touchDate = $nameDate.Substring(0,12) + "." + $nameDate.Substring(12,2)
$newDate = [datetime]::ParseExact($touchDate, "yyyyMMddHHmm.ss", $null)
[System.IO.File]::SetCreationTime($filePath, $newDate)
[System.IO.File]::SetLastWriteTime($filePath, $newDate)
Add-Content -Path $logFound -Value "Date from filename set for: $fileName → $newDate"
} catch {
Add-Content -Path $logError -Value "Invalid date in filename: $fileName"
}
} else {
Add-Content -Path $logError -Value "No valid date found for: $fileName"
}
}
}
}
# Execute processing
Process-Folder -path $folder
[System.Windows.Forms.MessageBox]::Show("Done! All files processed.")
3. Import the photos to kDrive
Once your photos are ready, if there aren't too many of them (a few thousand items) and your Internet connection is suitable, you can simply open the Web app kDrive (online service kdrive.infomaniak.com) and choose to import the folder containing your photos to the desired location:
- Click here to access the Web app kDrive Infomaniak (online service kdrive.infomaniak.com).
- Navigate to the location that will host your photos.
- Click on the New button at the top left.
- Click on Import a folder.
- Select the folder containing your photos on your computer.
- Wait until your data has been fully imported (the activity log scrolls at the bottom right):
Otherwise, if you are synchronizing your data using the desktop app, simply place your photos in the folder structure of your kDrive folder on your computer. Synchronization will begin, and your photos will be securely sent to the Infomaniak servers.
4. Access your photos from your devices
You can now access your photos on your various connected devices to kDrive (until they synchronize if it is the desktop app kDrive).
On the Web app kDrive (online service kdrive.infomaniak.com), you can change the layout to better view your pictures with an enlarged display of thumbnails:
This guide details how to import data from iCloud using rClone on kDrive Infomaniak.
COMPATIBILITY my kSuite ✗ | my kSuite+ ✗ ✔= Compatible offer | ✗= Not available |
Preamble
- Since Apple does not offer an API like its competitors, one solution to retrieve documents from an iCloud Drive is to install the kDrive macOS app to synchronize the icloud folder, which should be in your library. The guide below offers a solid alternative.
- kDrive supports rclone streaming upload via WebDAV, up to 50 Go (extendable to 100 Go) to prevent abuse, with automatic error handling if the limit is exceeded without prior specification of the size via
Content-Length
.
1. Set up rclone for drive access
Installing rclone on your computer
There is a version of rclone with a graphical interface (GUI) but it is quite possible to do this via command line (CLI):
- Install rclone from a terminal application on your device by entering the following command:
sudo -v ; curl https://rclone.org/install.sh | sudo bash
- Enter the password for your session on your computer to start the installation:
- Refer to the official installation guide if necessary.
Configuring the remote drive (iCloud) on rclone
- Once rclone is installed, enter the command
rclone config
.- Refer to the official configuration guide if necessary.
- Then choose to configure a new remote import by answering
n
forNew remote
. - Name the remote disk, for example
appledrive
: - Then choose the type of disk to import by answering
iclouddrive
which corresponds to iCloud Drive among the choices offered. - Tell rclone the
apple_id
by entering your Apple ID (usually an email address). - Choose to use your own password linked to the Apple ID account (
y
). - Enter your password twice as prompted:
- Answer “No”
n
to the question about “advanced configuration”. - A window on your device should open to warn you about a remote connection; authorize it:
- A window on your device should open with a 2FA code; copy it:
- Paste the code when rclone it asks you.
- Answer “Yes”
y
to the last question if all the presented information is correct.
Configuration of the destination disk (kDrive) on rclone
It is possible to act directly on the configuration file of rclone by pasting your kDrive configuration in the following format, for example:
[kDrive]
type = webdav
url = https://kDrive_ID_HERE.connect.kdrive.infomaniak.com/
vendor = other
user = user@email.com
pass = PASSWORD_HERE_OR_APP_PASSWORD_IF_2FA
But here is how to proceed step by step, just like for the previous configuration:
- Still in the terminal, enter
n
for a new disk configuration and enter the namekDrive
to recognize your destination disk: - Then choose the type of disk to import by answering
webdav
which corresponds to a WebDAV configuration from the options provided. - Enter the following information:
url
= direct access to kDrive (refer to this other guide regarding the kDrive ID for the connection URL)vendor
= rclone (option number 6)user
= email address to log in to the Infomaniak user account
- Answer “Yes”
y
when prompted for the password, then enter the password:- application password if two-factor authentication is enabled or the one for your Infomaniak user account if you have not enabled 2FA.
- Leave
bearer_token
empty then answer “No”n
to the question about “advanced configuration”. - Answer “Yes”
y
to the last question and your 2 disks will be displayed:
2. Copy iCloud data to kDrive
Prerequisites
- Check the available options on the official guide before starting an import.
Example command to start copying your iCloud data to the root of your kDrive:
sudo rclone copy appledrive: kDrive:
This will instantly start copying your folders, subfolders, and iCloud contents to your personal folder on your Infomaniak kDrive!
Details about the dates of your exported photos
If you export your photos from iCloud to kDrive Infomaniak, be mindful of the date metadata. During export, the file creation dates may be altered and replaced with the export date instead of the original capture date.
Here is a script for advanced users that allows you to restore the correct data to your files from the EXIF information (it is recommended to process batches of 7000 photos max. to avoid a crash):
- Download ExifTool https://exiftool.org/index.html (macOS Package).
- Install the application by allowing it to open first if necessary:
- Open Script Editor (located in your Applications > Utilities folder):
- Click on New document.
- Copy and paste the long script provided below into the Script Editor window.
- Click on Run to start the script, a window opens:
- Select the folder to analyze.
- Let the script run, it will modify the dates or write errors in a file
errors.txt
on the desktop.
The script to copy and paste in full:
-- replace file date with EXIF creation date or date from name after the first dash -
tell application "Finder"
set FolderPath to choose folder with prompt "Select the folder containing the files to update"
my processFolder(FolderPath)
end tell
on processFolder(aFolder)
tell application "Finder"
-- process files:
set fileList to files of aFolder
repeat with eachFile in fileList
-- process a single file
set theFile to eachFile
set AppleScript's text item delimiters to {""}
set fileName to name of eachFile --get the file name
set eachFile to eachFile as string --file path
set hasDate to true --initialize date found flag
try
--get date if available
set photoDate to do shell script "/usr/local/bin/exiftool -DateTimeOriginal " & quoted form of POSIX path of eachFile
if photoDate is "" then set photoDate to do shell script "/usr/local/bin/exiftool -CreationDate " & quoted form of POSIX path of eachFile
if photoDate is "" then set photoDate to do shell script "/usr/local/bin/exiftool -CreateDate " & quoted form of POSIX path of eachFile
if photoDate is "" then
set hasDate to false --check if date was found
end if
on error
set hasDate to false -- error retrieving date
set photoDate to ""
end try
if length of photoDate > 20 then
--format extracted date
set x to (length of photoDate) - 33
set OriginalDate to text -x thru -1 of photoDate
set formattedDate to text 1 thru 5 of OriginalDate
set theYear to formattedDate
set formattedDate to formattedDate & text 7 thru 8 of OriginalDate
set theMonth to text 7 thru 8 of OriginalDate
set formattedDate to formattedDate & text 10 thru 11 of OriginalDate
set theDay to text 10 thru 11 of OriginalDate
set formattedDate to formattedDate & text 13 thru 14 of OriginalDate
set theHour to text 13 thru 14 of OriginalDate
set formattedDate to formattedDate & text 16 thru 17 of OriginalDate
set theMinute to text 16 thru 17 of OriginalDate
set formattedDate to formattedDate & "." & text 19 thru 20 of OriginalDate
set theSecond to text 19 thru 20 of OriginalDate
set newName to theYear & "-" & theMonth & "-" & theDay & " " & theHour & "." & theMinute & "." & theSecond
set testValue to formattedDate as string --check if found date is 000
if testValue is " 000000000000.00" then
set hasDate to false
else
-- set file date to original EXIF date and write to log
do shell script "touch -t " & formattedDate & " " & quoted form of POSIX path of eachFile
set logFile to open for access ((path to desktop folder as text) & "Date Found.txt") as text with write permission
write "Original date found for file: " & OriginalDate & " " & eachFile & return to logFile starting at eof
close access logFile
end if
end if
if hasDate is false then
-- get date from file name after first dash
set nb to ""
set nameDate to ""
set fileName to fileName as string
set savedDelimiters to AppleScript's text item delimiters --save delimiters
set AppleScript's text item delimiters to {"-"} --split on "-"
set nb to offset of "-" in fileName
if nb is not 0 then
set AppleScript's text item delimiters to savedDelimiters --restore delimiters
set nameDate to characters (nb + 1) thru (nb + 8) of fileName as string
set nameDate to nameDate & "1200.00"
set cmd1 to "/usr/local/bin/exiftool -datetimeoriginal=" & nameDate & " " & quoted form of POSIX path of eachFile
set cmd2 to "/usr/local/bin/exiftool -createdate=" & nameDate & " " & quoted form of POSIX path of eachFile
end if
try
-- write date from name to EXIF
do shell script cmd1
do shell script cmd2
do shell script "touch -t " & nameDate & " " & quoted form of POSIX path of eachFile
do shell script "rm " & quoted form of POSIX path of (eachFile & "_original")
on error
-- if date from name is invalid, log the error
set logFile to open for access ((path to desktop folder as text) & "Date Error.txt") as text with write permission
write "No valid date found in file name: " & eachFile & return to logFile starting at eof
close access logFile
end try
end if
end repeat
-- process folders:
set folderList to folders of aFolder
repeat with eachSubfolder in folderList
-- process a subfolder
my processFolder(eachSubfolder)
end repeat
end tell
end processFolder
tell application "Finder"
display dialog "Done! All files processed." buttons {"Close"}
end tell