// Schedule: 0 0 */2 * *// Name: Scheduled Folder Backup// Description: Incrementally backup a folder to an external SSD every 2 days using rsync.import "@johnlindquist/kit"try {// 1. Prompt the user to select the source folder for backupconst sourceFolder = await path({hint: "Select folder to backup:",onlyDirs: true,});if (!sourceFolder) {notify("Backup cancelled: Source folder not selected.");exit(); // Exit the script if no source folder is selectedreturn;}// 2. Prompt the user to select the destination folder on the external SSDconst destinationFolder = await path({hint: "Select external SSD destination:",onlyDirs: true,});if (!destinationFolder) {notify("Backup cancelled: Destination folder not selected.");exit(); // Exit if no destination folder is selectedreturn;}// 3. Construct the rsync command for incremental backup// -avz: archive mode (recursive, preserves permissions, times, etc.), verbose, compress// --delete: delete extraneous files from destination dirs (files that no longer exist in source)// --progress: show progress during transfer for better user feedbackconst command = `rsync -avz --delete --progress "${sourceFolder}/" "${destinationFolder}"`;// 4. Execute the rsync commandawait exec(command);// 5. Notify the user that the backup has completed successfullynotify("Backup completed successfully!");} catch (error) {// 6. Handle any errors that occur during the backup processconsole.error(`Backup failed: ${error}`);notify({title: "Backup Failed!",body: "See logs for details.",icon: "error" // You might need to define or have a default 'error' icon});}