Jump to main content Jump to doc navigation

xPDOCacheManager::copyFile

Copies a file from a source file to a target directory. Takes the following options as an optional 3rd parameter:

  • copy_newer_only - If the source file is older than the target, it will not copy the file.
  • copy_preserve_permissions - xPDO will attempt to copy over the permission structure from the source file to the target. Defaults to false.
  • copy_preserve_filemtime - xPDO will attempt to copy over the modified time from the source file to the target file. Defaults to true.
  • copy_return_file_stat - Setting to true will return the php stat() information in the return array. Defaults to false.
  • new_dir_permissions - The permissions to set any new directories to that were created in the target. (Can also be the 4th parameter of copyFile.) Defaults to 0775.
  • new_file_permissions - The permissions to set the new file to if copy_preserve_permissions is false. Defaults to 0664.

Syntax

API Docs: http://api.modxcms.com/xpdo/cache/xPDOCacheManager.html#copyFile

boolean|array copyFile (string $source, string $target, [array $options = array()])

Example

Copy a file:

$xpdo->cacheManager->copyFile('/my/path/to/file.txt','/my/new/path/dir/');

See Also

  1. xPDOCacheManager.copyFile
  2. xPDOCacheManager.copyTree
  3. xPDOCacheManager.delete
  4. xPDOCacheManager.deleteTree
  5. xPDOCacheManager.endsWith
  6. xPDOCacheManager.escapeSingleQuotes
  7. xPDOCacheManager.get
  8. xPDOCacheManager.getCachePath
  9. xPDOCacheManager.getCacheProvider
  10. xPDOCacheManager.matches
  11. xPDOCacheManager.replace
  12. xPDOCacheManager.writeFile
  13. xPDOCacheManager.set
  14. xPDOCacheManager.writeTree
  15. xPDOCacheManager

Support the team building MODX with a monthly donation.

The budget raised through OpenCollective is transparent, including payouts, and any contributor can apply to be paid for their work on MODX.

Backers

  • modmore
  • STERC
  • Jens Wittmann – Gestaltung & Entwicklung
  • Fabian Christen
  • Digital Penguin
  • Dannevang Digital
  • Sepia River Studios
  • CrewMark
  • Chris Fickling
  • deJaya
  • Following Sea
  • Anton Tarasov
  • eydolan
  • Raffy
  • Lefthandmedia
  • Murray Wood
  • Snow Creative
  • Nick Clark
  • Helen
  • JT Skaggs
  • krisznet
  • YJ
  • Yanni
  • Richard

Budget

$366 per month—let's make that $500!

Learn more