WP Cloud Plugins
PluginsPlayground ↗⏵ Open Ticket
  • Getting Started
    • System Requirements
    • Installation
    • Connect a Cloud Account
    • Add your First Module
    • How to Update?
  • Licensing
    • Activate License
    • Deactivate/Move license
    • Local/Staging sites
    • License FAQ
  • Global Options
    • Layout
    • Personal Folders
    • Review & Approve
    • Integrations
    • Notifications
    • Permissions
    • Usage Limits
    • Security
    • Advanced
    • Statistics
    • Tools
  • Modules
    • Module Manager
    • Module Configurator
      • Content
      • Accessibility
      • Dynamic Folders
      • Actions
      • Review & Approve
      • Layout
      • Sort Order
      • Filters
      • Upload Settings
      • Usage Limits
      • Notifications
    • Modules
      • Audio player
      • Button
      • Embed
      • File Browser
      • Gallery
      • List
      • Review & Approve
      • Search Box
      • Slider / Carousel
      • Upload Box
      • Video player
  • Features
    • Dynamic Folders
      • Automatic mode
      • Manual mode
    • Personal Folders
      • FAQs
    • Embed documents
    • Import to Media Library
    • Video Advertisements
    • Statistics
    • Webhooks
  • Integrations
    • Advanced Custom Fields (ACF)
    • Form Plugins
      • Contact Form 7
      • Fluent Forms
      • Formidable Forms
      • Gravity Forms
      • GravityPDF
      • NinjaForms
      • WPForms
    • Page Builders
      • Beaver Builder
      • Classic Editor
      • Divi Page Builder
      • Gutenberg
      • Elementor
    • Slack
    • Uncanny Automator
    • WooCommerce
      • Digital Downloads
      • Order Uploads
    • Easy Digital Downloads (EDD)
  • Developers
    • Actions
    • API
      • copy()
      • copy_folder_recursive()
      • create_folder()
      • create_edit_url()
      • create_preview_url()
      • create_shared_url()
      • create_temporarily_download_url()
      • delete()
      • download()
      • get_entry()
      • get_folder()
      • move()
      • patch()
      • rename()
      • set_account_by_id()
      • set_drive_by_id()
      • upload_file()
    • Filters
    • Placeholders
  • Other
    • FAQs
    • Translations
    • Vulnerabilities
    • Support
      • Scope
      • Open a Support Ticket
    • About Us
    • Changelog
Powered by GitBook
On this page
  1. Developers
  2. API

copy()

Copy files and folders

copy()

This method will copy items to a new location.

Parameters

Name
Type
Description

$entry_ids

array

ID of the entries that should be copied.

$target_id

string

ID of the folder where the entry should be copied to.

Return

Name
Type
Description

$nodes

CachedNode[]

An array of objects for the copied files/folders.

Usage

WPCP_ONEDRIVE_API::set_account_by_id('8c9bacda0-d8d8-4b22-b634-7b5281687575');
WPCP_ONEDRIVE_API::set_drive_by_id('b!DlaHWskCed_MIid3KpJH5Lbatf9HsdXBAZH5YcvPAbMhJUKzTJyzgvXZYpBS');

$entry_ids = [
  '01EXLSWHWMQZNDMLRG7NFIWAVYCFJAXP2R',
  '01EXLSWHW3APNASPERAVGJEAVQAMUNIKF6'
];

$nodes = WPCP_ONEDRIVE_API::copy($entry_ids, '01EXLSWHRCD7RDL3HX65BK5X3ULXLWSICN');

Parameters

Name
Type
Description

$entry_ids

array

ID of the entries that should be copied.

$target_id

string

ID of the folder where the entry should be copied to.

Return

Name
Type
Description

$nodes

CachedNode[]

An array of objects for the copied files/folders.

Usage

WPCP_GDRIVE_API::set_account_by_id('201096615285735764133')

$entry_ids = [
  '1wzWlDMsZkA4N5yEEAmMigp52u7M0Lk_7',
  '1w7wpGF9jo4ZDmFaXxoBRDbCnotCmypJZ'
];

$nodes = WPCP_GDRIVE_API::copy($entry_ids, '1FCYkOJb150I8nl8DE92YIXWaB0J7VOk5');

Parameters

Name
Type
Description

$request

array

An array with 'path' keys. Path can both be an ID or a actual path.

Return

Name
Type
Description

$entries

Entry[]

An array of objects for the copied files/folders.

Usage

WPCP_DROPBOX_API::set_account_by_id('dbid:AADSy6JxzbgqCs4A43CAAAfO9xvZwpcsLU');

$request = ['entries' =>  []];

$request['entries'][] = ['from_path' => '/Homework/math', 'to_path' => '/Homework/algebra'];
$request['entries'][] = ['from_path' => '/Documents/a picture.jpg', 'to_path' => '/Documents/just a picture.jpg'];

$entries = WPCP_DROPBOX_API::copy($request);

Parameters

Name
Type
Description

$id

string

ID of the entry that should be copied.

$new_parent_id

string

ID of the folder where the entry should be copied to.

$new_name

string

The new name for the copied file. No value means that the same name will be used.

$is_dir

bool

Is the entry a folder or a file?

Return

Name
Type
Description

$node

CachedNode

The cached object for the copied file/folder.

Usage

WPCP_BOX_API::set_account_by_id('29232154182');

$node = WPCP_BOX_API::copy('51142665', '511426724354', null, false);

PreviousAPINextcopy_folder_recursive()

Last updated 6 months ago