Stay organized with collections
Save and categorize content based on your preferences.
CopyOption
interface CopyOption
Known Indirect Subclasses
|
An object that configures how to copy or move a file.
Objects of this type may be used with the Files.copy(Path,Path,CopyOption...)
, Files.copy(InputStream,Path,CopyOption...)
and Files.move(Path,Path,CopyOption...)
methods to configure how a file is copied or moved.
The StandardCopyOption
enumeration type defines the standard options.
Summary
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# CopyOption\n\nAdded in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nCopyOption\n==========\n\n```\ninterface CopyOption\n```\n\n|-------------------------------|\n| [java.nio.file.CopyOption](#) |\n\n|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Known Direct Subclasses [LinkOption](/reference/kotlin/java/nio/file/LinkOption), [StandardCopyOption](/reference/kotlin/java/nio/file/StandardCopyOption) |--------------------------------------------------------------------------|-----------------------------------------------------------| | [LinkOption](/reference/kotlin/java/nio/file/LinkOption) | Defines the options as to how symbolic links are handled. | | [StandardCopyOption](/reference/kotlin/java/nio/file/StandardCopyOption) | Defines the standard copy options. | |\n\n|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Known Indirect Subclasses [LinkOption.NOFOLLOW_LINKS](/reference/kotlin/java/nio/file/LinkOption#ENUM_VALUE:NOFOLLOW_LINKS), [StandardCopyOption.ATOMIC_MOVE](/reference/kotlin/java/nio/file/StandardCopyOption#ENUM_VALUE:ATOMIC_MOVE), [StandardCopyOption.COPY_ATTRIBUTES](/reference/kotlin/java/nio/file/StandardCopyOption#ENUM_VALUE:COPY_ATTRIBUTES), [StandardCopyOption.REPLACE_EXISTING](/reference/kotlin/java/nio/file/StandardCopyOption#ENUM_VALUE:REPLACE_EXISTING) |-----------------------------------------------------------------------------------------------------------------------|---------------------------------------------------| | [LinkOption.NOFOLLOW_LINKS](/reference/kotlin/java/nio/file/LinkOption#ENUM_VALUE:NOFOLLOW_LINKS) | Do not follow symbolic links. | | [StandardCopyOption.ATOMIC_MOVE](/reference/kotlin/java/nio/file/StandardCopyOption#ENUM_VALUE:ATOMIC_MOVE) | Move the file as an atomic file system operation. | | [StandardCopyOption.COPY_ATTRIBUTES](/reference/kotlin/java/nio/file/StandardCopyOption#ENUM_VALUE:COPY_ATTRIBUTES) | Copy attributes to the new file. | | [StandardCopyOption.REPLACE_EXISTING](/reference/kotlin/java/nio/file/StandardCopyOption#ENUM_VALUE:REPLACE_EXISTING) | Replace an existing file if it exists. | |\n\nAn object that configures how to copy or move a file.\n\nObjects of this type may be used with the [Files.copy(Path,Path,CopyOption...)](/reference/kotlin/java/nio/file/Files#copy(java.nio.file.Path,%20java.nio.file.Path,%20java.nio.file.CopyOption)), [Files.copy(InputStream,Path,CopyOption...)](/reference/kotlin/java/nio/file/Files#copy(java.io.InputStream,%20java.nio.file.Path,%20java.nio.file.CopyOption)) and [Files.move(Path,Path,CopyOption...)](/reference/kotlin/java/nio/file/Files#move(java.nio.file.Path,%20java.nio.file.Path,%20java.nio.file.CopyOption)) methods to configure how a file is copied or moved.\n\nThe [StandardCopyOption](/reference/kotlin/java/nio/file/StandardCopyOption) enumeration type defines the *standard* options.\n\nSummary\n-------"]]