Rclone is a command-line program to manage and sync files on 70+ cloud storage.
- Configure Rclone
- Rclone commands reference to manage and sync files.
- ImageKit backend config reference
Configure Rclone
Download the latest version of Rclone from the official website and follow the installation instructions.
Before you begin, get your urlEndpoint, publicKey, and privateKey from your ImageKit dashboard.
Run the following command to configure Rclone with ImageKit:
- Open your command line interface and run rclone config.
- Choose nfor a new remote.
- Name your new remote (eg: imagekit-media-library)
- Select the number corresponding to ImageKit.iowhen prompted for storage type.
- Enter your urlEndpoint,publicKey, andprivateKeywhen prompted.
After you've completed the above steps, you should see a remote added, as shown below. Finally, select q to exit the interactive config session.
A few things to keep in mind when using Rclone with ImageKit:
- Avoid the synccommand, as it will delete files in the destination that are not in the source.
- Avoid copying files to the root folder /inside ImageKit, as it can accidentally overwrite existing files. Always create specific folders and then copy files to them.
- Pass the --progress --no-check-destflag to see the progress of the file transfer and avoid checking the destination to speed up the process.
Migrate files & folders from local file system to ImageKit
Rclone allows you to sync and transfer all your media assets from a local filesystem to your ImageKit's Media Library.
Let's say you want to copy all the files in a local folder at /path/to/imagekit/folder to ImageKit inside a new folder i.e., testing
cd /path/to/local/folder rclone copy . imagekit-media-library:/testing
If you want to copy a single file, the command would look like this:
rclone copy /path/to/local/file.jpg imagekit-media-library:/testing
If the testing folder doesn't exist in ImageKit, it will be created automatically.
Migrate files & folders from ImageKit to the local file system
Rclone also allows you to sync and bring all your media assets from ImageKit's Media Library to your local filesystem.
Let's say you want to copy all the files in ImageKit's folder testing to the local folder /path/to/local/folder. Ensure /path/to/local/folder exists before running the command.
rclone copy imagekit-media-library:/testing /path/to/local/folder
Listing files in ImageKit
You can list all the files in a folder in ImageKit using the following command:
rclone ls imagekit-media-library:/testing
Migrate files from S3 to ImageKit
Rclone also allows you to sync and bring all your media assets from S3 to ImageKit's Media Library.
Let's say you want to copy all the files in the S3 bucket my-bucket to ImageKit inside a new folder, i.e. testing.
First, configure your Amazon S3 bucket as a remote in Rclone.
rclone copy s3:my-bucket imagekit-media-library:/testing