v1.8.22
  • Solutions
    • Multiplatform
    • Server-side
    • Data science
    • Android
  • Docs
  • Community
  • Teach
  • Play
    • Playground
    • Hands-on
    • Examples
    • Koans
← Docs
kotlin-stdlib / kotlin.io / java.io.File / relativeToOrSelf

relativeToOrSelf

JVM
1.0
fun File.relativeToOrSelf(base: File): File
(source)

Calculates the relative path for this file from base file. Note that the base file is treated as a directory. If this file matches the base file, then a File with empty path will be returned.

Return File with relative path from base to this, or this if this and base paths have different roots.

Stay in touch:
  • Contributing to Kotlin
  • Releases
  • Press Kit
  • Security
  • Blog
  • Issue Tracker
  • Brand assets
  • Careers
Kotlin™ is protected under the Kotlin Foundation and licensed under the Apache 2 license.
Supported and developed by JetBrains