Copy folder
post
https://api.imagekit.io
/v1/bulkJobs/copyFolder
Copy folder API
In case of an error, you will get an error code along with the error message. On success, you will receive a
200
status code with JSON encoded response containing information about jobId
. You can use jobId
to get the status of this job using bulk job status API.Here is the example request to understand the API usage.
cURL
Node.js
Python
PHP
Java
Ruby
Go
.Net
curl -X POST "https://api.imagekit.io/v1/bulkJobs/copyFolder" \
-H 'Content-Type: application/json' \
-u your_private_key: -d '
{
"sourceFolderPath" : "/folder/to/copy",
"destinationPath" : "/folder/to/copy/into/",
"includeFileVersions": true
}
'
var ImageKit = require("imagekit");
var imagekit = new ImageKit({
publicKey : "your_public_api_key",
privateKey : "your_private_api_key",
urlEndpoint : "https://ik.imagekit.io/your_imagekit_id/"
});
imagekit.copyFolder({
sourceFolderPath: "/folder/to/copy",
destinationPath: "/folder/to/copy/into/",
includeFileVersions: false // optional
}, function(error, result) {
if(error) console.log(error);
else console.log(result);
});
from imagekitio import ImageKit
imagekit = ImageKit(
public_key='your_public_api_key',
private_key='your_private_api_key',
url_endpoint = 'https://ik.imagekit.io/your_imagekit_id/'
)
copy_folder = imagekit.copy_folder(options=CopyFolderRequestOptions(source_folder_path='/source_folder_path',
destination_path='/destination/path',
include_file_versions=True))
print("Copy folder-", copy_folder, end="\n\n")
# Raw Response
print(copy_folder.response_metadata.raw)
# print the job's id
print(copy_folder.job_id)
use ImageKit\ImageKit;
$public_key = "your_public_api_key";
$your_private_key = "your_private_api_key";
$url_end_point = "https://ik.imagekit.io/your_imagekit_id";
$imageKit = new ImageKit(
$public_key,
$your_private_key,
$url_end_point
);
$sourceFolderPath = "/folder/to/copy";
$destinationPath = "/folder/to/copy/into/";
$includeFileVersions = false;
$copyFolder = $imageKit->copyFolder([
'sourceFolderPath' => $sourceFolderPath,
'destinationPath' => $destinationPath,
'includeFileVersions' => $includeFileVersions
]);
echo("Copy Folder : " . json_encode($copyFolder));
CopyFolderRequest copyFolderRequest = new CopyFolderRequest();
copyFolderRequest.setSourceFolderPath("/folder/to/copy");
copyFolderRequest.setDestinationPath("/folder/to/copy/into/");
copyFolderRequest.setIncludeFileVersions(true);
ResultOfFolderActions resultOfFolderActions = ImageKit.getInstance().copyFolder(copyFolderRequest);
imagekitio = ImageKitIo::Client.new("your_private_key", "your_public_key", "your_url_endpoint")
imagekitio.copy_folder(
source_folder_path: '/folder/to/copy',
destination_path: '/folder/to/copy/into/',
include_file_versions: false # optional
)
resp, err := ik.Media.CopyFolder(ctx, media.CopyFolderParam{
SourceFolderPath: "/folder/to/copy",
DestinationPath: "/folder/to/copy/into/",
IncludeVersions: false, // optional
})
var imagekit = new ImageKit({
publicKey : "your_public_api_key",
privateKey : "your_private_api_key",
urlEndpoint : "https://ik.imagekit.io/your_imagekit_id/"
});
CopyFolderRequest cpyFolderRequest = new CopyFolderRequest
{
sourceFolderPath = "/folder/to/copy",
destinationPath = "/folder/to/copy/into/",
includeFileVersions = false // optional
};
ResultOfFolderActions resultOfFolderActions = imagekit.CopyFolder(cpyFolderRequest);
Last modified 6mo ago